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

On Fri, Sep 19, 2014 at 9:49 AM, Shawn Ligocki <sligocki@google.com> wrote:
> 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??)

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.

~TJ

Received on Friday, 19 September 2014 17:34:09 UTC