Re: @font-face rules

Ian Hickson wrote:
> 
> On Tue, 9 Nov 1999, Erik van der Poel wrote:
> > 
> > CSS2, section 15.3.1:
> >
> >   Note that if the font 'Robson Celtic' had been installed on the
> >   client system, this would have caused the UA to add an entry in
> >   the font database for the installed copy as described in the
> >   section on the font matching algorithm. The installed copy
> >   would have been matched before the downloadable font in the
> >   example above.
> >
> > Which part of the CSS2 spec specifies how the various @font-face rules
> > override each other?
> 
> The penultimate paragraph of section 15.3.1 reads:
> # If a font descriptor is duplicated, the last occurring descriptor
> # wins and the rest must be ignored.

I did actually notice that paragraph, but I think it's referring to the
descriptors, not the @font-face rules. For example, the "src" descriptor
is duplicated in the following @font-face rule:

  @font-face {
    font-family: Foo;
    src: url("http://this/one/loses");
    src: url("http://this/one/wins");
  }

My question was about the example given in the spec. That example refers
to a "Robson Celtic" installed on the machine. Presumably, that means
that the following @font-face rule would be added to the database by the
UA:

  @font-face {
    font-family: "Robson Celtic";
    src: local("Robson Celtic");
  }

In the example, the document contains the following @font-face rule:

  @font-face {
    font-family: "Robson Celtic";
    src: url("http://site/fonts/rob-celt")
  }

The spec says that the installed copy would have been matched before the
downloadable font. So, my question is: Which part of the CSS2 spec
states how one @font-face rule is matched before another? In the example
above, is it because the UA's @font-face rules take precedence over any
@font-face rules in the document? Or is it because locally installed
fonts take precedence over downloadable ones? Or some other reason?

> > Does this mean that the document can specify its own font
> > descriptors for the generic font "serif", and that these descriptors
> > will be used rather than the UA's own descriptors?
> 
> Yes, since the 'font-family' descriptor takes <generic-family> and the
> author's CSS sheet comes after the UA's.

I understand that the UA ought to let the user select fonts for each of
the generics (serif, monospace, etc). The 3rd paragraph of section
15.2.6 says:

  User agents are encouraged to allow users to select
  alternative choices for the generic fonts.

I suppose this could be implemented via a user style sheet. So, is an
author style sheet supposed to be able to specify its own descriptors
for the generic fonts? If all 3 of the style sheets (UA, user and
author) specify descriptors for the generic fonts, which one wins?

For properties, CSS2 states the following precedence rule:

  author > user > UA

For !important declarations, the following rule:

  user > author > UA

However, @font-face rules contain font *descriptors*, not font
*properties*. So, do @font-face rules follow the same precedence rules
as properties? If not, what rule(s) do they follow? Also, is it possible
to attach !important to @font-face rules and/or font descriptors?

Erik

Received on Sunday, 14 November 1999 14:05:55 UTC