W3C home > Mailing lists > Public > www-style@w3.org > April 2015

Re: [css-font-loading] family name parsing note

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 8 Apr 2015 17:55:02 -0700
Message-ID: <CAAWBYDCUPLt+oPrCh-6e-sJuBSkgu6j+qmDMcygPz++HB9LxKA@mail.gmail.com>
To: John Daggett <jdaggett@mozilla.com>
Cc: www-style <www-style@w3.org>
On Thu, Mar 26, 2015 at 7:35 PM, John Daggett <jdaggett@mozilla.com> wrote:
> I think it might be a good idea to add a note about the parsing of font
> family names in Section 2.1. The spec currently defines the parsing of
> the family argument to the FontFace constructor as:
>   Parse the family argument, and the members of the descriptors
>   argument, according to the grammars of the corresponding
>   descriptors of the CSS @font-face rule.
> This is fine I think but the current Chrome implementation treats the
> family argument as if it was already quoted, such that the assertion
> below will fail:
>   var f1 = new FontFace("@blah", "url(x)");
>   assert(f1.status == "error"); // @blah is not a valid name unless quoted
> Suggested note:
> As with font family names within @font-face rules, the family argument
> is a single font family name. It can be unquoted or quoted and it cannot
> be a generic font family name (e.g. sans-serif).
> Test examples:
>   var f2 = new FontFace("'simple'", "local(Georgia)");
>   assert(f2.status == "unloaded");
>   document.fonts.add(f2);
>   document.fonts.load("simple");
>   assert(f2.status != "unloaded"); // simple == 'simple' so f2 should be
> loading

Alternately, we could just define that the family argument is taken
literally (matching Chrome behavior).  I don't think there's really
any need to invoke the weird parsing rules we have for family names.

Received on Thursday, 9 April 2015 00:55:49 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:50 UTC