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

Re: [css2.1] [css3-fonts] <family-name> ambiguous - partially quoted names allowed?

From: fantasai <fantasai.lists@inkedblade.net>
Date: Wed, 22 Apr 2009 10:25:06 -0700
Message-ID: <49EF52F2.40306@inkedblade.net>
To: www-style@w3.org
Bert Bos wrote:
> On Tuesday 21 April 2009, Zack Weinberg wrote:
>> Mozilla has a bug report[1] requesting that this:
>>
>>   font-family: "lucida" grande;
>>
>> be treated as equivalent to this:
>>
>>   font-family: lucida grande;
>>
>> There is no formal grammar for <family-name> and the prose does not
>> say whether some-but-not-all tokens of a family-name can be quoted. 
>> Matter of fact, it doesn't really explain what the grammar is at all
>> - it just says that certain punctuation characters must be \-escaped
>> if they appear unquoted in a family-name.
>>
>> My preferred reading of the spec would disallow partial quotation,
>> but what I really care about as an implementor is that there be an
>> unambiguous, ideally formal, grammar for every nonterminal.
> 
> Partially quoted names were not among the original use cases. Maybe it's 
> possible to read the spec as syntactically allowing them, but it 
> certainly doesn't define what they mean.
> 
> The intent can, I think, be captured by this annotated grammar:
> 
>   Value: [ [ <family-name> | <generic-family> ] [ , <family-name> |
>     <generic-family> ]* ] | inherit;
>   <generic-family>: serif | sans-serif | cursive | fantasy | monospace;
>   <family-name>: STRING | IDENT+;  /* see restriction below */
> 
> where the restriction is that <family-name> cannot be one of the single 
> IDENTs serif, sans-serif, cursive, fantasy, monospace, inherit, default 
> or initial.

This doesn't seem correct to me. The spec says

   # If an unquoted font family name contains parentheses, brackets,
   # and/or braces, they must still be escaped per CSS grammar rules.
   # Similarly, quotation marks (both single and double), semicolons,
   # exclamation marks, commas, and leading slashes within unquoted
   # font family names must be escaped.

So

   font-family: #weirdfont, serif;

is allowed by the spec prose, but not in your grammar. Now, I'm not
convinced that it /should/ be allowed. :) But we need testcases to
see what implementations do--do they literally follow the prose, or
your proposed grammar, or something else entirely?

~fantasai
Received on Wednesday, 22 April 2009 17:25:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 03:46:58 GMT