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

Re: [css3-fonts] font descriptor default values

From: John Daggett <jdaggett@mozilla.com>
Date: Wed, 21 Jan 2009 22:33:02 -0800 (PST)
To: Michael Day <mikeday@yeslogic.com>
Cc: www-style <www-style@w3.org>
Message-ID: <16105090.6287771232605982094.JavaMail.root@cm-mail01.mozilla.org>

> > The way 'all' was defined in the CSS2 font spec has a number of
> > problems:
> 
> These seem like good arguments that an omitted font descriptor property 
> should default to normal, so as not to override more specific values 
> used on other @font-face rules.
> 
> Is there still any value in allowing an "all" keyword or in allowing 
> multiple values to be specified for a given property? Or is only 
> specifying one value sufficient, given that the font matching algorithm 
> can effectively interpolate between values?

All font descriptors other than font-family, src, and unicode-range are
single values that default to 'normal'.  Multiple values would result
in the font descriptor being ignored (but not the rule).

> Back to the original example:
> 
> @font-face {
>      font-family: MyFont;
>      src: local("Times New Roman")
> }
> 
> You stated:
> 
> > This seems simple, but to really make this work you're going to need
> > four rules to cover each of the four common style variations -
> > normal, bold, italic and bold italic, since a single @font-face rule
> > only defines a single *face* within a family. 
> 
> Is it necessary to have four rules? If there are no other @font-face
> rules defining MyFont, then won't this one be used whenever MyFont is
> requested, regardless of the requested font weight or style?

Yes, you would need four rules, one for each face, assuming a font with
the standard regular, bold, italic and bold italic set of faces.  So your 
example above would look like:

@font-face {
  font-family: MyFont;
  src: local("Times New Roman");
}

@font-face {
  font-family: MyFont;
  src: local("Times New Roman Bold");
  font-weight: bold;
}

@font-face {
  font-family: MyFont;
  src: local("Times New Roman Italic");
  font-style: italic;
}

@font-face {
  font-family: MyFont;
  src: local("Times New Roman Bold Italic");
  font-weight: bold;
  font-style: italic;
}

With only the first rule, you would only ever see "Times New Roman", perhaps
with synthetic bolding/italics depending on the user agent, none of the bold
or italic faces would be used.  The behavior would match the behavior you would
see if you just used "Times New Roman" in a font list on a system with only the regular face.

Cheers,

John Daggett
Mozilla Japan
Received on Thursday, 22 January 2009 06:33:43 GMT

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