W3C home > Mailing lists > Public > www-style@w3.org > May 2012

Re: [css2.1][css3-fonts] keywords in unquoted font family names

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 22 May 2012 00:00:44 +0200
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Bert Bos <bert@w3.org>, www-style list <www-style@w3.org>
Message-ID: <2lblr7pu07bt0on77dao35lfb0btig4lfg@hive.bjoern.hoehrmann.de>
* Tab Atkins Jr. wrote:
>On Mon, May 21, 2012 at 8:17 AM, Bert Bos <bert@w3.org> wrote:
>> On May 18, 2012, at 08:34, John Daggett wrote:
>>> Both Tab and Elika feel that any unquoted name that includes
>>> keywords like 'inherit' should be invalid, so declarations like
>>> the ones below would be invalid:
>>>  font-family: foo inherit;
>>>  font-family: inherit foo;
>> I don't see any ambiguity in the spec about these. They are valid family names. Some real-world examples would be:
>>    font-family: Microsoft Sans Serif
>>    font-family: Schoolhouse Cursive B
>I don't understand.  Neither of your examples have global keywords in
>them, so they don't seem to be relevant.

My impression is that Bert does not look at it that way. Neither do I.
"Global keywords" mainly cause weird problems, `list<list<int>>` in C++
for instance, or { for: [], against: [] } in JavaScript, neither of
which is allowed, per old standards anyway, because ">>" always means a
right shift to the machine parser, but not to the human parser, and a
'for' is always for 'for' loops even though you can't use ':' after the
'for', so there isn't any ambiguity, just as there isn't any above, the
"foo inherit" font family is valid just like "Microsoft Sans Serif" is.

Naturally odd rules like this are not implemented consistently, while
Opera and Internet Explorer reject the JS code, Firefox has no issues
with it. And they cause trouble when you want to make new "global key-
words". If CSS had a rule like this, when "initial" was proposed some-
one likely would have raised that breaking

  font-family: Initial Caps, serif;

even though there is nothing obviously wrong with it, is perhaps not a
good idea. If "inherit" was made not-an-identifier, everything that at
the moment allows identifiers would also "need" to allow other syntax,
so you can write `attr("inherit" ...)`, otherwise there would no way to
address an attribute named "inherit", unless you have some rule saying
"inherit" is a keyword in <family-name> but not in some other places.

I you take the original CSS 2.0 Recommendation, it has

  [[ <family-name> | <generic-family> ],]*
   [<family-name> | <generic-family>] | inherit

I would read that as

  font-family: inherit;

taking the right branch, assuming an implicit priority, and

  font-family: example, inherit;
  font-family: inherit, example;

as taking the left branch, there is no other way how this would match
the grammar. `font-family: inherit;` can't take the left branch as then
you could not actually use that with the intended meaning. I don't see
why one would this read in some other way, or why "Initial Caps" should
have to be quoted from now on. We also don't require quoting 'Example
sans-serif' even though sans-serif is a keyword in font-family.
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
Received on Monday, 21 May 2012 22:01:28 UTC

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