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

I'm looking into adding @font-face parsing to our CSS parser and I'm trying
to figure out how to represent them. It would make it much simpler if all
the @font-face rules could be stored in a separate list from the rulesets.
But this would only be safe if the relative order doesn't matter between
@font-face rules and rulesets. Otherwise, we'd need to preserve the
original ordering.

For example, are the following equivalent:

  @font-face { ...1 }
  .a { ...2 }
  @font-face { ...3 }
  .b { ...4 }

and

  @font-face { ...1 }
  @font-face { ...3 }
  .a { ...2 }
  .b { ...4 }

no matter what the ...s contain? Or could the .a being between the two
@font-faces cause the interpretation to differ? (Say only respect the font
from the first @font-face rule and not the second??)

I know the order of @font-face rules matter relative to each other, and the
order of rulesets likewise matter relative to each other. So for example,
this re-organization would clearly be wrong:

  @font-face { ...3 }
  @font-face { ...1 }
  .b { ...4 }
  .a { ...2 }

because it would change the overriding behavior in some cases. But I can't
find much explanation at http://dev.w3.org/csswg/css-fonts/#font-face-rule
for whether or not order matters between @font-face and rulesets.

Thanks,
-Shawn

Received on Friday, 19 September 2014 16:49:53 UTC