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

[css-font-loading] family name parsing note

From: John Daggett <jdaggett@mozilla.com>
Date: Fri, 27 Mar 2015 11:35:07 +0900
Message-ID: <CALYZoVOHOgY+zPo-VV0r4F5eO78h2PiGVsZbPV8PkH+EuOdhRA@mail.gmail.com>
To: www-style <www-style@w3.org>
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

Regards,

John Daggett
Received on Friday, 27 March 2015 02:35:34 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC