You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[css-fonts-4] font-kerning:normal and CJK fonts with kerning pairs for fullwidth not well defined #6723
Normal kerning for CJK fonts that support the ‘kern’ feature should only apply the feature on proportional glyphs. By default this means excluding the fullwidth CJK glyphs and only kerning the proportional Latin glyphs.
If kerning the CJK fullwidth glyphs you must also apply ‘palt’ (‘vpal’ in vertical) or the kerning amounts will be incorrect. This kerning should be optional and not the default.
Regarding optionality and the default: CSS Fonts 4 does not specify that kerning is on by default. The initial value is 'auto':
auto
Specifies that kerning is applied at the discretion of the user agent
When set to auto, user agents can determine whether to apply kerning or not based on a number of factors: text size, script, or other factors that influence text processing speed.
However it does claim that:
When rendering with OpenType fonts, the [OPENTYPE] specification suggests that kerning be enabled by default.
Many features expose optional capabilities that authors and typographers may choose to use at their discretion; for example, small cap forms, or kerning.
So I wonder where that claim came from and whether we should remove it.
Regarding the specifics of kerning and CJK, I wonder if we can expand the mention of "script" quoted above to give the specific details that fixed-width glyphs should not be kerned. I don't find the 'palt' or 'vpal' tables in the OpenType specification, nor in the TrueType specification. Where are they defined?
Discussing with @MurakamiShinyu, we outlined 5 possible things that an author might want to do:
no kerning
kern non-CJK† only
apply palt/vpal and kern everything
apply palt/vpal and kern non-CJK
apply palt/vpal and kern nothing
Of these 5, the first 3 seem to be clearly needed; the last two, we're not sure. Either way, the spec should clarify that kerning CJK requires applying palt/vpal as well.
A question raised was whether palt/vpal should be applied via font-variant-east-asian where we already have the somewhat-related proportional-width keyword. But font-variant is fundamentally about alternate glyphs whereas palt/vpal is about spacing, so font-kerning is probably a better place to control it.
Possible syntax for these options:
font-kerning: none
font-kerning: normal
font-kerning: all (new keyword)
Unclear if we need this (not easy to work around if needed)
Unclear if we need this (can use font-feature-settings if needed‡)
It might be useful to hear from @macnmm and others if options 4 or 5 are needed.
† The appropriate division here is probably East Asian Wide vs others.
‡ The naive way to do this would be font-kerning: none; font-feature-settings: "palt", but this doesn't handle writing modes correctly, so the correct way to do it would be font-kerning: all; font-feature-settings: "kern" off, "vkrn" off.
Reacted by Florian Rivoal, Shinyu Murakami and Ln-north
I don't think option 4 is common. Option 5 is common only because most CJK fonts lack kerning pairs so palt/vpal is their only option for proportional layout and they may have documents that do not set kerning on or have it set to 0. However, option 5 would also turn off kerning for non-CJK, so perhaps it is not common because of that.
I think it is better not to be able to do palt-on/kern-off because it is bad know-how, although some people are tempted to do it for the purpose of "loose kerning" even in DTP.
(translated from Japanese)
For "loose kerning" purpose, it will be better to use letter-spacing together with font-kerning: all, e.g.:
.loose-kerning {
font-kerning: all; /* 'palt' on, 'kern' on */letter-spacing:0.05em;
}
How about sending this issue to OpenType, so that they can improve the definition?
Given existing fonts are incompatible today, they can improve the definition so that future fonts being more compatible. They could also define features that can make both types of fonts happy, and CSS can define a property to control the features.
With the current shaping engine APIs, it's not easy for browsers to apply features only if glyphs are fullwidth. Resolving this issue by the cooperation with OpenType and shaping engines can also ensure browsers match the native applications.
How about sending this issue to OpenType, so that they can improve the definition?
Given existing fonts are incompatible today, they can improve the definition so that future fonts being more compatible. They could also define features that can make both types of fonts happy, and CSS can define a property to control the features.
With the current shaping engine APIs, it's not easy for browsers to apply features only if glyphs are fullwidth. Resolving this issue by the cooperation with OpenType and shaping engines can also ensure browsers match the native applications.
I am not aware of font incompatibilities -- when the font has 'kern' values set on fullwidth glyphs, they must necessarily start from the 'palt' widths, otherwise they would have too many pairs and not achieve proportional typography, which is the point of kerning.
As far as when to apply proportional features, this is kind of the legacy of CJK fonts mixing proportional Latin with monospaced CJK in one font by default, but offering non-default widths and kerning as an option. Not sure a new OTF feature would solve this differently...
With the current shaping engine APIs, it's not easy for browsers to apply features only if glyphs are fullwidth.
Does this mean that it is difficult to not apply 'kern' only if glyphs are fullwidth?
In @fantasai's suggestion, “2. kern non-CJK† only” does not require checking if glyphs are really fullwidth, because “† The appropriate division here is probably East Asian Wide vs others.”
This better default font-kerning behavior “kern non-CJK only” is already implemented in Firefox (effective when font-kerning: auto. Their font-kerning: normal corresponds to font-kerning: all in the new proposal here).
I think this default “kern non-CJK only” is very nice for most CJK fonts. However, this may be not good for some not very common CJK fonts which have proportional CJK glyphs by default (not by 'palt') and have kerning feature. I am not aware of such Japanese fonts, but it would be possible. (MS PGothic and MS PMincho are well known examples of Japanese proportional fonts, but they have no kerning feature.)
font implementing palt + kern, without apkn: activate palt and kern together.
font implementing apkn: activate palt and apkn together. kern remains active as usual, since in such a font it carries only pairs for glyphs that are proportional by default.
I assume that this is for horizontal typographic modes (and for sideways typesetting in vertical typographic modes).
For for upright typesetting in vertical typographic modes, without apkn, would palt + vkrn be used?
Regarding the application of proportional metrics and pair kerning to glyphs representing Japanese characters, essentially the same principles apply to the vertical writing mode as to the horizontal writing mode.
In horizontal text, the 'palt' feature is used to make glyphs representing Japanese characters (primarily kana glyphs) behave as if they had proportional widths and sidebearings, while 'apkn' or 'kern' is used to apply kerning to specific pairs of these glyphs. The 'palt' feature must not be applied by default. The 'apkn' feature must not be applied unless the 'palt' feature has been explicitly applied. The 'kern' feature must not be applied to Japanese glyphs unless the 'palt' feature has been explicitly applied. The 'apkn' feature must not be applied by default. If the 'apkn' feature is absent, the 'kern' feature must not be applied to Japanese glyphs unless the 'palt' feature has been explicitly applied.
In vertical text, the 'vpal' feature is used to make glyphs representing Japanese characters (primarily kana glyphs) behave as if they had proportional widths and sidebearings, while 'vapk' or 'vkrn' is used to apply kerning to specific pairs of these glyphs. The 'vpal' feature must not be applied by default. The 'vapk' feature must not be applied unless the 'vpal' feature has been explicitly applied. The 'vkrn' feature must not be applied to Japanese glyphs unless the 'vpal' feature has been explicitly applied. The 'vapk' feature must not be applied by default. If the 'vapk' feature is absent, the 'vkrn' feature must not be applied to Japanese glyphs unless the 'vpal' feature has been explicitly applied.
I think these principles should apply, but please point out any errors you find.
In addition, as mentioned above, if 'palt' and 'kern' are present but 'apkn' is absent, 'kern' must not be applied unless 'palt' is applied to Japanese glyphs. However, once 'palt' is applied, 'kern' may also be applied. If 'kern' is applied, it must be applied to all glyph pairs for which kerning is defined, including pairs containing Japanese or non-Japanese glyphs that are not covered by 'palt'
This is important because not all Japanese glyphs in glyph pairs for which kerning is defined need to be made proportional using 'palt', although most of them typically do. The same principle applies to 'apkn' and 'palt'.
If a font supports this feature and also supports kerning, it is recommended that kerning for glyphs affected by this feature be implemented using the 'apkn' feature and not the 'kern' feature. (The 'kern' feature should still be used for glyphs that have proportional widths by default.)
I have therefore made palt + kern a SHOULD NOT, unless apkn is not available. I also scoped it to only those gyphs with Proportional Alternate Widths, to make it clear that kern should be applied to the other glyphs.
I have therefore made palt + kern a SHOULD NOT, unless apkn is not available. I also scoped it to only those gyphs with Proportional Alternate Widths, to make it clear that kern should be applied to the other glyphs.
I think you mean:
I have therefore made palt + kern a SHOULD NOT, if apkn is available.
I also scoped it to only those gyphs with Proportional Alternate Widths, to make it clear that kern should be applied to the other glyphs.
I don't understand this well.
When applied to Japanese glyphs, either 'kern' or 'apkn' may cover glyphs that are not covered by 'palt' (Proportional Alternate Widths).
Thanks for the review of these sections. I guess the wording from Opentype that I quoted above is aimed at font developers (use this, not that), not so much at developers of text rendering software (if it has this, do this thing; if it has that, do another; if it has both then ...)
Could you suggest better wording for the current text;
For these glyphs, the kern feature is not used; instead, the Kerning for Alternate Proportional Widths must be applied, using the apkn feature.
For those who will attend TPAC, either in person or remotely, this issue is on the agenda for the Tuesday morning joint meeting between CSS WG and I18 Core WG. Members of JLReq Task Force would also be most welcome at that meeting.
I'm trying to get this specification in the best shape before that meeting, to aid discussion as the text is further clarified and refined.
I feel like my understanding of apkn and palt (mainly their differences) is a bit lacking. The activation conditions for both seem to be the same, so I'm suspecting that one of them might not even have a reason to exist. I modified my most recent comment slightly: #6723 (comment)
Activity
xfq commentedon Oct 12, 2021
Spec URL: https://drafts.csswg.org/css-fonts-4/#font-kerning-prop
svgeesus commentedon Oct 12, 2021
Regarding optionality and the default: CSS Fonts 4 does not specify that kerning is on by default. The initial value is 'auto':
However it does claim that:
I don't find that suggestion in the definition of the kern table or the GPOS table and find the opposite in the OpenType overview:
So I wonder where that claim came from and whether we should remove it.
Regarding the specifics of kerning and CJK, I wonder if we can expand the mention of "script" quoted above to give the specific details that fixed-width glyphs should not be kerned. I don't find the 'palt' or 'vpal' tables in the OpenType specification, nor in the TrueType specification. Where are they defined?
svgeesus commentedon Oct 12, 2021
Oh I see they are OpenType features, not tables: 'palt' and 'vpal'
macnmm commentedon Oct 13, 2021
Agree that 'auto' is currently confusing and those UAs that apply the 'kern' feature when kerning is 'auto' will run into the CJK issue above.
frivoal commentedon Jan 27, 2023
These messages (in Japanese) are relevant to this discussion:
fantasai commentedon Feb 1, 2023
Discussing with @MurakamiShinyu, we outlined 5 possible things that an author might want to do:
Of these 5, the first 3 seem to be clearly needed; the last two, we're not sure. Either way, the spec should clarify that kerning CJK requires applying palt/vpal as well.
A question raised was whether palt/vpal should be applied via
font-variant-east-asianwhere we already have the somewhat-relatedproportional-widthkeyword. Butfont-variantis fundamentally about alternate glyphs whereas palt/vpal is about spacing, sofont-kerningis probably a better place to control it.Possible syntax for these options:
font-kerning: nonefont-kerning: normalfont-kerning: all(new keyword)font-feature-settingsif needed‡)It might be useful to hear from @macnmm and others if options 4 or 5 are needed.
† The appropriate division here is probably East Asian Wide vs others.
‡ The naive way to do this would be
font-kerning: none; font-feature-settings: "palt", but this doesn't handle writing modes correctly, so the correct way to do it would befont-kerning: all; font-feature-settings: "kern" off, "vkrn" off.macnmm commentedon Feb 2, 2023
I don't think option 4 is common. Option 5 is common only because most CJK fonts lack kerning pairs so palt/vpal is their only option for proportional layout and they may have documents that do not set kerning on or have it set to 0. However, option 5 would also turn off kerning for non-CJK, so perhaps it is not common because of that.
MurakamiShinyu commentedon Feb 4, 2023
I tweeted about extending the
font-kerningproperty values for CJK proportional spacing and kerning,and got many supportive reactions for the new value
all(= 3. apply palt/vpal and kern everything).Options 4 and 5 do not appear to be needed. I got a reply about it:
https://twitter.com/monokano/status/1620989798264758272
(translated from Japanese)
For "loose kerning" purpose, it will be better to use
letter-spacingtogether withfont-kerning: all, e.g.:kojiishi commentedon Feb 7, 2023
How about sending this issue to OpenType, so that they can improve the definition?
Given existing fonts are incompatible today, they can improve the definition so that future fonts being more compatible. They could also define features that can make both types of fonts happy, and CSS can define a property to control the features.
With the current shaping engine APIs, it's not easy for browsers to apply features only if glyphs are fullwidth. Resolving this issue by the cooperation with OpenType and shaping engines can also ensure browsers match the native applications.
/cc @litherum @jfkthame
macnmm commentedon Feb 8, 2023
I am not aware of font incompatibilities -- when the font has 'kern' values set on fullwidth glyphs, they must necessarily start from the 'palt' widths, otherwise they would have too many pairs and not achieve proportional typography, which is the point of kerning.
As far as when to apply proportional features, this is kind of the legacy of CJK fonts mixing proportional Latin with monospaced CJK in one font by default, but offering non-default widths and kerning as an option. Not sure a new OTF feature would solve this differently...
MurakamiShinyu commentedon Mar 4, 2023
@kojiishi:
Does this mean that it is difficult to not apply 'kern' only if glyphs are fullwidth?
In @fantasai's suggestion, “2. kern non-CJK† only” does not require checking if glyphs are really fullwidth, because “† The appropriate division here is probably East Asian Wide vs others.”
This better default font-kerning behavior “kern non-CJK only” is already implemented in Firefox (effective when
font-kerning: auto. Theirfont-kerning: normalcorresponds tofont-kerning: allin the new proposal here).I think this default “kern non-CJK only” is very nice for most CJK fonts. However, this may be not good for some not very common CJK fonts which have proportional CJK glyphs by default (not by 'palt') and have kerning feature. I am not aware of such Japanese fonts, but it would be possible. (MS PGothic and MS PMincho are well known examples of Japanese proportional fonts, but they have no kerning feature.)
On Korean font kerning, Requirements for Hangul Text Layout and Typography - §2.4 Kerning for Hangul Fonts is very interesting.
AG Ahnsangsoo 2012 is a proportional Hangul font family with kerning feature.
Kerning should be enabled for CJK text by default for such fonts. So I think the normal font-kerning behavior should be corrected to:
Is this difficult to implement?
kojiishi commentedon Apr 14, 2023
There is a long Japanese thread at public-i18n-japanese, still without consensus.
I replied to @MurakamiShinyu's questions above in the Japanese thread.
17 remaining items
svgeesus commentedon Oct 16, 2026
I assume that this is for horizontal typographic modes (and for sideways typesetting in vertical typographic modes).
For for upright typesetting in vertical typographic modes, without
apkn, wouldpalt+vkrnbe used?taroyamamoto-451 commentedon Oct 17, 2026
Regarding the application of proportional metrics and pair kerning to glyphs representing Japanese characters, essentially the same principles apply to the vertical writing mode as to the horizontal writing mode.
In horizontal text, the 'palt' feature is used to make glyphs representing Japanese characters (primarily kana glyphs) behave as if they had proportional widths and sidebearings, while 'apkn' or 'kern' is used to apply kerning to specific pairs of these glyphs. The 'palt' feature must not be applied by default. The 'apkn' feature must not be applied unless the 'palt' feature has been explicitly applied. The 'kern' feature must not be applied to Japanese glyphs unless the 'palt' feature has been explicitly applied. The 'apkn' feature must not be applied by default. If the 'apkn' feature is absent, the 'kern' feature must not be applied to Japanese glyphs unless the 'palt' feature has been explicitly applied.
In vertical text, the 'vpal' feature is used to make glyphs representing Japanese characters (primarily kana glyphs) behave as if they had proportional widths and sidebearings, while 'vapk' or 'vkrn' is used to apply kerning to specific pairs of these glyphs. The 'vpal' feature must not be applied by default. The 'vapk' feature must not be applied unless the 'vpal' feature has been explicitly applied. The 'vkrn' feature must not be applied to Japanese glyphs unless the 'vpal' feature has been explicitly applied. The 'vapk' feature must not be applied by default. If the 'vapk' feature is absent, the 'vkrn' feature must not be applied to Japanese glyphs unless the 'vpal' feature has been explicitly applied.
I think these principles should apply, but please point out any errors you find.
taroyamamoto-451 commentedon Oct 17, 2026
In addition, as mentioned above, if 'palt' and 'kern' are present but 'apkn' is absent, 'kern' must not be applied unless 'palt' is applied to Japanese glyphs. However, once 'palt' is applied, 'kern' may also be applied. If 'kern' is applied, it must be applied to all glyph pairs for which kerning is defined, including pairs containing Japanese or non-Japanese glyphs that are not covered by 'palt'
This is important because not all Japanese glyphs in glyph pairs for which kerning is defined need to be made proportional using 'palt', although most of them typically do. The same principle applies to 'apkn' and 'palt'.
[css-fonts-4] Normatively state the dependency on palt for kerning #6723
svgeesus commentedon Oct 22, 2026
OpenType says
I have therefore made
palt+kerna SHOULD NOT, unlessapknis not available. I also scoped it to only those gyphs with Proportional Alternate Widths, to make it clear thatkernshould be applied to the other glyphs.svgeesus commentedon Oct 22, 2026
Please take a look at the new wording regarding
apknandpalt:https://www.w3.org/TR/css-fonts-4/#font-kerning-prop
tats-u commentedon Oct 22, 2026
What if a font vendor cannot think of even a single pair of glyphs for which apkn should be set?
svgeesus commentedon Oct 22, 2026
In that case,
apknwould be empty, presumably not included in the font, and thuskernwould be used.taroyamamoto-451 commentedon Oct 23, 2026
svgeesus wrote:
I think you mean:
I have therefore made palt + kern a SHOULD NOT, if apkn is available.
I don't understand this well.
When applied to Japanese glyphs, either 'kern' or 'apkn' may cover glyphs that are not covered by 'palt' (Proportional Alternate Widths).
tats-u commentedon Oct 23, 2026
I wonder if this is technically possible:
kern should not be applied to pairs where at least one of the glyphs can have palt applied when palt is disabled (, as long as apkn is missing).
svgeesus commentedon Oct 23, 2026
Thanks for the review of these sections. I guess the wording from Opentype that I quoted above is aimed at font developers (use this, not that), not so much at developers of text rendering software (if it has this, do this thing; if it has that, do another; if it has both then ...)
Could you suggest better wording for the current text;
svgeesus commentedon Oct 23, 2026
For those who will attend TPAC, either in person or remotely, this issue is on the agenda for the Tuesday morning joint meeting between CSS WG and I18 Core WG. Members of JLReq Task Force would also be most welcome at that meeting.
I'm trying to get this specification in the best shape before that meeting, to aid discussion as the text is further clarified and refined.
tats-u commentedon Oct 23, 2026
I feel like my understanding of apkn and palt (mainly their differences) is a bit lacking. The activation conditions for both seem to be the same, so I'm suspecting that one of them might not even have a reason to exist. I modified my most recent comment slightly: #6723 (comment)