W3C home > Mailing lists > Public > www-style@w3.org > September 2014

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

From: Shawn Ligocki <sligocki@google.com>
Date: Fri, 19 Sep 2014 15:13:00 +0000
Message-ID: <CACNG_47AbWCM+7FJSRS7aGvxREF+M8m0pga1eS-z+bbyvO6uDw@mail.gmail.com> (sfid-20140919_151306_637646_1614BD23)
To: www-style <www-style@w3.org>
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 Wednesday, 24 September 2014 14:30:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:46 UTC