W3C home > Mailing lists > Public > www-style@w3.org > November 2014

[css-fonts] Why not allow redefining generic font families by @font-face?

From: duanyao <duanyao@ustc.edu>
Date: Fri, 14 Nov 2014 12:25:53 +0800
Message-ID: <54658451.3010402@ustc.edu>
To: www-style list <www-style@w3.org>
Hi all,

@font-face rule allow us to define any font families, except "generic
font families", e.g. sans-serif and serif. However, there are use cases
that redefining generic font families are very helpful:

* Some UAs/OSs are missing certain generic font families. For example
android only has serif fonts for western languages, but not for east
asia languages. We want to provide a downloadable CJK serif font
(SimSun.otf) to compensate this issue:
@font-face {
font-family: "serif";
src: local("SimSun"),
unicode-range: U+FF-FFFFFF;

* Some UAs have mis-configured generic font families. For example,
firefox on windows assigns "SimSun" font to both serif and sans-serif
families for zh-CN locale by default. But "SimSun" is actually a serif
font, so we want to reset sans-serif to "HeiTi", a real sans font for
@font-face {
font-family: "sans-serif";
src: local("HeiTi");
unicode-range: U+FF-FFFFFF;

* Some UAs don't use different underlying fonts for different languages
if generic font families are used. For example, some UAs for zh-CN
locale use CJK fonts for both western and CJK texts, which makes western
texts look not good. We want to re-confiure this:
@font-face {
font-family: "sans-serif";
/* CJK fonts */
src: local("Droid Sans"), /* android, linux*/
local("HeiTi"); /* win */
@font-face {
font-family: "sans-serif";
src: local("Roboto"), /* android */
local("Arial"); /* win */
unicode-range: U+0-FF;

However, with current spec (http://dev.w3.org/csswg/css-fonts/) we can't
redefine generic font families, so we have to specify customized font
@font-face {
font-family: "my-sans-serif";
src: local("HeiTi");
unicode-range: U+FF-FFFFFF;

Customized font families work, but can be inconvenient, because we have
to change existing generic font families in all existing css files. For
user-generated contents, it is hard to ensure our customized font
families are used instead of generic font families. If redefining
generic font families would be possible, we could put these `@font-face`
rules into normalize.css/reset.css, and the whole site is beautified

So I wonder are there particular reasons to not allow redefining generic
font families?

Duan Yao.
Received on Friday, 14 November 2014 04:26:45 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:48 UTC