[css-fonts-4] Add support for Kai and Fangsong generic font families
Categories
(Core :: Layout: Text and Fonts, enhancement)
Tracking
()
People
(Reporter: xfq, Unassigned)
References
(Blocks 1 open bug)
Details
Steps to reproduce:
Use generic(kai) and generic(fangsong) in CSS font-family.
Actual results:
Kai and Fangsong fonts are not applied.
Expected results:
There are many font styles used in Chinese composition, but Song, Kai, Hei, and Fangsong are the most important ones.
The font-family CSS property should support generic family names for these font styles.
More: https://www.w3.org/TR/clreq/#four_commonly_used_typefaces_for_chinese_composition
css-fonts-4 describes generic(kai) and generic(fangsong) in CSS: https://drafts.csswg.org/css-fonts-4/#generic-font-families
The Kai and Fangsong generic font families significantly improves the fallback mechanism of Chinese websites and web applications. If the browsers does not support them, the differences expressed by the font styles won't appear (unless the author use web fonts, which is often too large).
Tests & results
Interactive test, font-family:generic(kai) will apply a Kai font in Chinese: https://github.com/w3c/character_phrase_tests/issues/62
Interactive test, font-family:generic(fangsong) will apply a Fangsong font in Chinese: https://github.com/w3c/character_phrase_tests/issues/25
CSS issue: https://github.com/w3c/csswg-drafts/issues/4606 (closed)
Reporter | ||
Comment 1•7 months ago
|
||
Comment 2•7 months ago
|
||
Thanks for the bug report.
A few references:
-
For
font-family:generic(kai)
, it seems this was added in a recent spec change in the issue that you linked, https://github.com/w3c/csswg-drafts/issues/4606 (commit: https://github.com/w3c/csswg-drafts/commit/6cfe259c7b4643f07a424bb5d498b8c8740fba6b ) -
For
generic(fangsong)
, it seems https://github.com/w3c/csswg-drafts/issues/4425#issuecomment-1749106947 updated the spec to use thegeneric()
syntax (commit: https://github.com/w3c/csswg-drafts/commit/fd9212d46788e8109d45a8347917a384139d32eb)
(In reply to Fuqiao Xue [:xfq] from comment #1)
See also https://searchfox.org/mozilla-central/source/modules/libpref/init/all.js
I think this may have been a copypaste typo -- that's a list of a whole bunch of about:config default values. Did you mean to link to a particular line in that file perhaps?
Updated•7 months ago
|
Reporter | ||
Comment 3•7 months ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #2)
(In reply to Fuqiao Xue [:xfq] from comment #1)
See also https://searchfox.org/mozilla-central/source/modules/libpref/init/all.js
I think this may have been a copypaste typo -- that's a list of a whole bunch of about:config default values. Did you mean to link to a particular line in that file perhaps?
I mean things like https://searchfox.org/mozilla-central/rev/16526d690cccc9c60cacf09cc08e2c3041ef884e/modules/libpref/init/all.js#2602-2605
Comment 4•7 months ago
|
||
More generally, we'll need to extend the parsing of font family names to support the new generic(<foo>)
syntax, and how to map that to prefs; only then can we see about adding appropriate font mappings for each platform.
Description
•