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

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

From: John Daggett <jdaggett@mozilla.com>
Date: Thu, 13 Nov 2014 21:07:41 -0800 (PST)
To: www-style list <www-style@w3.org>
Message-ID: <559273132.11925847.1415941661616.JavaMail.zimbra@mozilla.com>

Hi Duan Yao,

There are a few basic problems with allowing @font-face rules to
redefine generic font families. The first is that generic font
families, as you point out, often vary by language/script. That
makes trying to override them via @font-face rules problematic. The
second thing to point out is that an @font-face rule defines a
single *face* within a family, not a family. So using @font-face as
a way of aliasing one *family* to another also doesn't work very

I think some of the things you've pointed out are simply browser
settings that should be updated/improved. Part of the problem with
generics is that for many scripts it can be difficult to find fonts
available on all versions of Windows, so sometimes the settings are
set to pick up the lowest common denominator fonts across Windows

I'll file a bug on SimSum being used for sans-serif, for Firefox I
think we can do better. It's interesting to note here also that the
local Firefox communities in Taiwan and Hong Kong requested that the
default generic fonts be set to Latin fonts so that Latin text
appeared in those fonts while Chinese would appear in the default
font for Chinese via fallback. This is not ideal at all but as
platforms provide better CJK font support (e.g. with font families
such as Source Sans Han) I think this sort of hacked solution won't
be needed.


John Daggett
Mozilla Japan

----- Original Message -----
From: "duanyao" <duanyao@ustc.edu>
To: "www-style list" <www-style@w3.org>
Sent: Friday, November 14, 2014 1:25:53 PM
Subject: [css-fonts] Why not allow redefining generic font families by @font-face?

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 05:08:12 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:45 UTC