Re: [css-fonts] Does @font-face v. ruleset order matter?

Tab Atkins wrote:

> Relative ordering of @font-face and normal rules makes no difference
> to the use of those font faces; CSS is a properly declarative
> language, and doesn't have that sort of ordering dependence between
> resources and links.
>
> Since you don't care about preserving the overall stylesheet order,
> feel free to reorganize the @font-face rules, or stash them in a
> separate stylesheet.

The order of @font-face rules relative to style rules doesn't
matter. The relative order of @font-face rules *does* matter since
it influences the order in which fonts are loaded.

  @font-face {
    font-family: test;
    src: url(fallback.woff) format("woff");
    /* defaults to u+00-10ffff */
  }

  @font-face {
    font-family: test;
    src: url(basic.woff) format("woff");
    unicode-range: u+00-4ff;
  }

For characters in the basic Latin range, the ordering above implies
that the basic font is loaded before the general fallback font is loaded.

Step 5 of the font matching algorithm [1]:

  When the matched face is a composite face, user agents
  must use the procedure above on each of the faces in the
  composite face in reverse order of @font-face rule
  definition.

Cheers,

John

[1] http://www.w3.org/TR/css3-fonts/#font-style-matching

Received on Thursday, 25 September 2014 01:31:08 UTC