- From: duanyao <duanyao@ustc.edu>
- Date: Fri, 14 Nov 2014 23:23:33 +0800
- To: John Daggett <jdaggett@mozilla.com>, www-style list <www-style@w3.org>
Hi John Daggett, I've considered your points, here are my further thoughts: 1. Redefining generic font families for multiple languages/scripts by @font-face can be complicated, but I think it can be done by carefully specifying unicode-range for multiple @font-face. If we want to use different actual fonts for unified code points for different languages (e.g. Chinese and Japanese), maybe adding a "lang" descriptor to @font-face is needed. 2. Isn't defining multiple faces for a family with @font-face already possible by font-style/font-weight descriptor? E.g.: @font-face { font-family: "serif"; src: local("Times New Roman"); unicode-range: U+0-FF; } @font-face { font-family: "serif"; src: local("Times New Roman Bold"); unicode-range: U+0-FF; font-weight: bold; } 3. Authors are better than UAs to to decide what these generic font families should be. It is painful to figure out the best generic font families for every locales on every platforms, for both UA providers and web page authors. However, authors' tool -- CSS -- is portable. If some author has worked out a decent normalize-font.css and put it on a public CDN, many sites can benefit from it, and it is easy to keep up-to-date. In contrast, UAs' settings are not portable, so each UA providers may have to repeat the same work. Some smaller UA providers may simply don't have enough resources to get it right everywhere. Additionally, UAs can't provide missing fonts for generic font families, but authors can do it via @font-face. Lastly, even if UAs have better generic font families support in future, these is no guarantee of cross UA consistency. 4. Authors are usually better than users to to decide what these generic font families should be. Most browsers allow users to set the real font families for generic font families. However only a small fraction of users fully understand these settings; while for users who really understand, these settings are not powerful enough: they usually lacking the ability to specify different fonts for different unicode-range/language. 5. If generic font families are not reliable and consistent (this is case in China), many authors simply try to avoid them. Authors in China usually use long lists of possible fonts on popular OSs in font-family property. Needless to say, these lists can hardly be complete, up-to-date and maintainable. With @font-face, authors can centralize the font settings, but still have to avoid generic font families if they can't be redefined. This looks unfortunate to me: generic font families are not designed to be avoided, right? Regards, Duan Yao. 于 2014年11月14日 13:07, John Daggett 写道: > 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 > well. > > 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 > versions. > > 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. > > Regards, > > 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"), > url("http://mysite.net/SimSun.otf"); > 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 > Chinese: > @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 > families: > @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 > suddenly! > > So I wonder are there particular reasons to not allow redefining generic > font families? > > Regards, > Duan Yao. > > > >
Received on Friday, 14 November 2014 15:24:29 UTC