W3C home > Mailing lists > Public > www-style@w3.org > January 2009

Re: [css3-fonts] new editor's draft

From: John Daggett <jdaggett@mozilla.com>
Date: Tue, 20 Jan 2009 19:15:00 -0800 (PST)
To: Anne van Kesteren <annevk@opera.com>
Cc: www-style <www-style@w3.org>
Message-ID: <4594615.6252321232507700326.JavaMail.root@cm-mail01.mozilla.org>

> > Example 2
> > ===============================================
> >
> > @font-face {
> >   font-family: MyFont;
> >   src: local("OpenSymbol");
> > }
> >
> > @font-face {
> >   font-family: MyFont;
> >   src: local("Times New Roman");
> > }
> >
> > body { font-family: MyFont, sans-serif; }
> >
> > If text contained symbol characters without glyphs in Times New
> > Roman, glyphs from OpenSymbol would be used.
> >
> > Defined this way, authors have the ability to control load behavior
> > (example 1) and to control fallback behavior (example 2).
>
> Wouldn't it be better to simply require using MyFont1 and MyFont2
> rather than having some special behavior in case you have several
> @font-face blocks using the same identifier?
> 
> I personally would expect the last @font-face rule there to override
> the first.

If both fonts had the same character map in this case, the last one would completely override the first.  Since omitted font descriptors have an initial value, both declarations above would implicitly include:

  unicode-range: U+0-7FFFFFFF;

By defining the character map used during font fallback as the intersection of the unicode-range with the actual character map of the font, you allow fallback behavior that adapts to the font data.  This would be equivalent to explicitly specifying the exact character map for a given version of Times New Roman, here based on Times New Roman 2.6 which shipped with Mac OS X 10.4:

@font-face {
  font-family: MyFont;
  src: local("OpenSymbol");
}

@font-face {
  font-family: MyFont;
  src: local("Times New Roman");
  unicode-range: U+20-7E,U+A0-FF,U+131,U+152-153,U+160-161,U+178,U+192,U+2C6-2C7,U+2C9,U+2D8-2DD,U+2013-2014,U+2018-201E,U+2020-2022,U+2026,U+2030,U+2039-203A,U+2044,U+20AC,U+2122,U+2126,U+2202,U+2206,U+220F,U+2211,U+2219,U+221A,U+221E,U+222B,U+2248,U+2260,U+2264,U+2265,U+25CA,U+F001-F002,U+FB01-FB02; 
}

You're right, we could simply require authors to always specify MyFont1 and MyFont2, but for multi-language sites this doesn't scale well, each new language means editing all styles that specify the font-family property.  The really nice aspect of @font-face is that authors can define once, use many times, so changes to the underlying definition ripple through to all the places where it's used.

John Daggett
Mozilla Japan
Received on Wednesday, 21 January 2009 03:15:40 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:15 GMT