Kerning is applied to the CJK with "font-kerning: auto".
Categories
(Core :: Layout: Text and Fonts, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox108 | --- | affected |
People
(Reporter: tkita, Assigned: jfkthame)
References
Details
Attachments
(6 files)
Steps to reproduce:
- open https://tama-san.com/otf_test/
- check kerning is applied to the CJK part in 「デフォルト」(applied "font-kerning: normal") section.
Actual results:
Kerning('kern') is applied to CJK parts in 「デフォルト」 section.
Expected results:
Kerning('kern') should not be applied to CJK parts in 「デフォルト」 section.
According to OpenType Spec, in CJK Font, the setting value of 'kern' feature is set assuming that it is used together with 'palt'.
https://learn.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-palt
"If 'kern' is activated, 'palt' must also be activated if it exists. "
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Assignee | ||
Comment 2•2 years ago
|
||
(In reply to Takashi Kita from comment #0)
Expected results:
Kerning('kern') should not be applied to CJK parts in 「デフォルト」 section.
I think there are two questions to be considered here.
(1) When font-kerning: normal
is used, should the browser automatically apply palt
in addition to kern
, or is it the author's responsibility to enable that feature? Adobe's description in the feature registry implies that perhaps it should be done automatically (though I think an author should still be able to explicitly override this using the font-feature-settings
property).
(2) For CJK content, should we disable kerning by default (when font-kerning: auto
is in effect)? The feature registry suggests that kern
"should be active by default for horizontal text setting", but your expectation here seems to be that it should not be used by default for CJK text.
Currently, all the browsers I tried leave kerning enabled by default, so the 「デフォルト」 section does have kerning -- and therefore arguably should also have palt
applied. Would that be a reasonable default behavior?
Assignee | ||
Comment 3•2 years ago
|
||
(In reply to Takashi Kita from comment #0)
Steps to reproduce:
- open https://tama-san.com/otf_test/
- check kerning is applied to the CJK part in 「デフォルト」(applied "font-kerning: normal") section.
One small correction to the description here, to avoid possible confusion: in the default (デフォルト) section, the value of font-kerning
is not normal
but auto
. This means that kerning "is applied at the discretion of the user agent" (so we could, for example, make it dependent on the script involved), whereas normal
requires that kerning is applied.
Assignee | ||
Comment 4•2 years ago
|
||
Here's the result I get after modifying Firefox to (a) disable kerning for CJK scripts when font-kerning
is auto
, and (b) apply palt
by default when kerning is enabled for CJK scripts.
Does this match what you expect/believe is the proper behavior?
Reporter | ||
Comment 5•2 years ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #3)
(In reply to Takashi Kita from comment #0)
Steps to reproduce:
- open https://tama-san.com/otf_test/
- check kerning is applied to the CJK part in 「デフォルト」(applied "font-kerning: normal") section.
One small correction to the description here, to avoid possible confusion: in the default (デフォルト) section, the value of
font-kerning
is notnormal
butauto
. This means that kerning "is applied at the discretion of the user agent" (so we could, for example, make it dependent on the script involved), whereasnormal
requires that kerning is applied.
(1) When we are using "kerning" in CJK, we expect "palt" is applied. If "font-kering: normal" is in the state that kerning is ON, "font-kerning: normal" should apply "palt" and "kern" at the same time. (Note that for vertical writing, "kern" is changed to "vkrn" and "palt" to "vpal".)
(2) Yes, According to "Requirements for Japanese Text Layout / Principles of Arrangement of Kanji and Kana Characters" (https://www.w3.org/TR/jlreq/#principles_of_arrangement_of_kanji_and_kana_characters), we shouldn't use "kern" or "palt" in default.
(In reply to Jonathan Kew [:jfkthame] from comment #4)
Created attachment 9300333 [details]
Result of the example using a patched browserHere's the result I get after modifying Firefox to (a) disable kerning for CJK scripts when
font-kerning
isauto
, and (b) applypalt
by default when kerning is enabled for CJK scripts.Does this match what you expect/believe is the proper behavior?
Exactly. Good patch.
(In reply to Jonathan Kew [:jfkthame] from comment #3)
(In reply to Takashi Kita from comment #0)
Steps to reproduce:
- open https://tama-san.com/otf_test/
- check kerning is applied to the CJK part in 「デフォルト」(applied "font-kerning: normal") section.
One small correction to the description here, to avoid possible confusion: in the default (デフォルト) section, the value of
font-kerning
is notnormal
butauto
. This means that kerning "is applied at the discretion of the user agent" (so we could, for example, make it dependent on the script involved), whereasnormal
requires that kerning is applied.
As you said, default section is "font-kerning: auto", it is default state of typography, so I expect "palt" or "kern" is not applied in CJK text. I was confusing "auto" and "normal", so this topic title is also not correct. I expect "font-kerning: normal" will apply "palt" and "kern", "font-kerning: auto" will apply no features.
Assignee | ||
Comment 6•2 years ago
|
||
I've opened https://github.com/w3c/csswg-drafts/issues/7958 to suggest that the description of font-kerning
in the CSS Fonts spec should be updated to include the points raised here: (a) proportional alternates should be enabled together with kerning; and (b) kerning should not be applied to CJK text by default (when font-kerning: auto
is in effect).
(Corresponding Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1378462.)
Assignee | ||
Comment 7•2 years ago
|
||
As specified in the OpenType feature registry, e.g. at https://learn.microsoft.com/en-gb/typography/opentype/spec/features_ko#tag-kern.
Updated•2 years ago
|
Assignee | ||
Comment 8•2 years ago
|
||
Depends on D160495
Assignee | ||
Comment 9•2 years ago
|
||
Depends on D160496
Assignee | ||
Comment 10•2 years ago
|
||
Depends on D160497
Reporter | ||
Comment 11•2 years ago
|
||
Thanks a lot, I confirmed.
Let me know if you need more information.
Comment 12•2 years ago
|
||
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0368c9d06143 patch 1 - For CJK text, when kerning is enabled, also apply the OpenType 'palt' feature. r=layout-reviewers,jwatt. https://hg.mozilla.org/integration/autoland/rev/a129ec32ac74 patch 2 - Add a WPT test for the interaction of kerning and proportional-alternates features. r=jwatt https://hg.mozilla.org/integration/autoland/rev/b674f823de1a patch 3 - For CJK text, disable kerning by default (when font-kerning:auto is in effect); only apply it when explicitly requested. r=jwatt https://hg.mozilla.org/integration/autoland/rev/842963188422 patch 4 - Adjust cjk-kerning test to explicitly require kerning to be disabled by default for CJK text. r=jwatt
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/36731 for changes under testing/web-platform/tests
Comment 14•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/0368c9d06143
https://hg.mozilla.org/mozilla-central/rev/a129ec32ac74
https://hg.mozilla.org/mozilla-central/rev/b674f823de1a
https://hg.mozilla.org/mozilla-central/rev/842963188422
Upstream PR merged by moz-wptsync-bot
Comment 16•2 years ago
|
||
Hi, I think we shouldn't enable "palt" automatically when "kern" is enabled. since some websites are using font-feature-settings: "kern"
instead of font-kerning: normal
, and this change automatically enables "palt" in their websites, but I think they didn't expected about "palt" (since any browser didn't automatically enable "palt" previously) and some users (like me) feels difficult to read "palt" text (in my case, it is little, btw).
websites example: Mastodon since v0.6 https://github.com/mastodon/mastodon/commit/49520d6e627e49a1f9f1b8cfa9b323450307fcc6
I'm not sure why they are using this... but possibly EdgeHTML is a one of reason:
in EdgeHTML era (2015~2020), EdgeHTML didn't support font-kerning
https://developer.mozilla.org/en-US/docs/Web/CSS/font-kerning but supports font-feature-settings
https://developer.mozilla.org/en-US/docs/Web/CSS/font-feature-settings , so they needs to use font-feature-settings
for EdgeHTML (I'm not sure about they actually cares EdgeHTML)
Reporter | ||
Comment 17•2 years ago
|
||
To Assignee,
If the user wants to apply "palt" and "kern" simultaneously in font-feature-settings, the user should already have explicitly specified font-feature-settings: "palt", "kern";
, so the state in which "palt" is also applied when specifying font-feature-settings: "kern"
may indeed be contrary to the user's intent.
If only font-feature-settings: "kern"
is specified, the user may want to reflect only "kern". (For example, a font sales site might want to independently indicate that OpenType "kern" is implemented.)
If "palt" is set when font-feature-settings: "kern"
is specified, it is recommended that this be disabled for font-feature-settings.
Reporter | ||
Comment 18•2 years ago
|
||
If each feature is already applied independently in font-feature-settings, please change the status to CLOSED.
Updated•2 years ago
|
Comment 19•2 years ago
|
||
(In reply to Takashi Kita from comment #17)
To Assignee,
If the user wants to apply "palt" and "kern" simultaneously in font-feature-settings, the user should already have explicitly specified
font-feature-settings: "palt", "kern";
, so the state in which "palt" is also applied when specifyingfont-feature-settings: "kern"
may indeed be contrary to the user's intent.If only
font-feature-settings: "kern"
is specified, the user may want to reflect only "kern". (For example, a font sales site might want to independently indicate that OpenType "kern" is implemented.)If "palt" is set when
font-feature-settings: "kern"
is specified, it is recommended that this be disabled for font-feature-settings.
After this fix is applied, the following workaround changeset by bug 1798297 should be fixed.
https://hg.mozilla.org/mozilla-central/rev/99e2e426103b
Comment 20•2 years ago
|
||
At first, the behavior with patches in this bug suit the specification of Opentype.
So, if we want different behaviors against specification, should we open discussion about it?
Comment 21•2 years ago
|
||
(In reply to Toshihiro Yamada from comment #20)
At first, the behavior with patches in this bug suit the specification of Opentype.
So, if we want different behaviors against specification, should we open discussion about it?
Oh I have misunderstood the issue in bug 1798297.
This bug is fixed by changesets in comment 14 and should be closed.
By fixing this bug, "kern" and "palt" is set for CJK fonts including Yu Gothic UI font if font-feature-settings: auto
.
This follows the spec of OpenType.
Bug 1798297 has been reported as the regression of this bug.
However it is NOT the regression because the Yu Gothic UI font is one of the CJK fonts.
If the web page author want to apply only "kern" for Yu Gothic UI font, they should be set font-feature-settings: "palt" off
.
Assignee | ||
Comment 22•2 years ago
|
||
Re-closing, as this implements what the OpenType spec currently says. If there are additional concerns about this behavior, please file a new bug with details and specific examples/testcases for further consideration.
Description
•