Re: [css3-fonts] @font-face matching and font-style descriptor

John Daggett:
> 
> The default value of descriptors in @font-face rules are listed as the "Initial value", i.e. the value specified if no descriptor is explicitly defined.  The initial values of font-style descriptors is
> "normal", so the two rules you've defined are equivalent.  User agents will synthesize an italic face if needed.

Descriptors, unlike properties of the same name, should perhaps allow multiple values or a value (which would also be the default) of ‘any’ or ‘all’, because one resource may contain multiple styles, weights etc. For example, small caps used to be in separate files, but are now incorporated within OTF font files. If we redefined ‘normal’ as meaning “use this resource for all combinations encountered”, we would need new values for the upright / roman / … styles.

The Unicode range descriptor already works kind of like that.

> @font-face {
>  font-family: MyFont3;
>  src: local(Arial Italic);
>  font-style: normal;
> }

  foo {font-family: MyFont3; font-style: italic;}  
  bar {font-family: MyFont3; font-style: italic;}

> Should the browser add extra oblique to an already italic face if it's the single "normal" face defined for a family?

Yes, “foo” and “bar” should look different, as ugly as “bar” may become. Authors will also spot their errors easier this way.

The font-face descriptor value ‘normal’ could of course mean “inherent”, but it currently does not.

Font Descriptor Values

  ‘inherent’ (recommended)
      Only use this resource for what it actually supports. 
      Do not generate “faux” anything.
  ‘any’      (new default)
      Assume this resource includes support for all possible values. 
      Generate “faux” variant if necessary and possible, 
      otherwise fall back to ‘normal’.
  ‘normal’   (old default)
      Assume this resource includes support for that value. 
      Do not generate “faux” anything.
  specific value(s)
      Assume this resource includes support for that value. 
      Generate “faux” variant if necessary and possible, 
      otherwise fall back to ‘normal’.

  standard  := ‘inherent’ | ‘normal’ | ‘any’

  <style>   := standard | [
             [ ‘upright’ | ‘italic’ | ‘oblique’
             ] ‘,’^ ]+

  <weight>  := standard | [
             [ ‘medium’ | ‘bold’ | ‘100’ | … | ‘900’
             ] ‘,’^ ]+

  <stretch> := standard | [
             [ ‘?loose?’ | modifier? [ ‘condensed’ | ‘expanded’ ] 
             ] ‘,’^ ]+

  modifier  := [ ‘ultra’ | ‘extra’ | ‘semi’ ] ‘-’

  <range>   := standard | [ urange ‘,’^ ]+
  urange    := ‘U+’ [ [ unicode ‘-’^ ] | anycode ]
  unicode   := hexdigit{1,4} | plane hexdigit{4}
  anycode   := ‘?’{1,6} | [ ‘0’ | ‘1’ ] ‘?’{5} | plane ‘?’{4}
             | plane? hexdigit ‘?’{3} | plane? hexdigit{1,2} ‘?’{2} 
             | plane? hexdigit{1,3} ‘?’
  plane     := [ ‘0’? hexdigit | ‘10’ ]

		[a b^]  :=  a [b a]?
		[a b^]? := [a [b a]?]?
		[a b^]* := [a [b a]*]?
		[a b^]+ :=  a [b a]*

> Tab Atkins Jr. wrote:
> 
>> It should probably say "initial value", which is defined for every property.
> 
> Agreed, although I would note these are *not* properties but descriptors.

Yes, and conceptually descriptors are more similar to selectors than properties (in the CSS sense), hence an alternative, perhaps more intuitive syntax could have been

  @font-face MyFont:style(upright) {source: local(Arial);}
  @font-face MyFont:style(italic)  {source: local(Arial italic);}
  @font-face MyFont:weight(bold)   {source: local(Arial bold);}
  @font-face MyFont:weight(bold):style(italic) {source: local(Arial bold italic);}

However, what is currently called “font features” in section 4.6, i.e. ‘font-variant’ and ‘font-feature-setting’, should *not* be called “decriptors”, “feature” or “property” works. I’m not completely sure about variant, though.

Received on Tuesday, 14 September 2010 18:42:06 UTC