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

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

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Wed, 22 Apr 2009 15:49:32 +0200
Message-ID: <65307430904220649t3ab411admfe8e343cf68346e@mail.gmail.com>
To: Bert Bos <bert@w3.org>
Cc: W3C Emailing list for WWW Style <www-style@w3.org>
2009/4/22 Bert Bos <bert@w3.org>:
> 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.
>
> (The spec is not worded very well with respect to 'default'
> and 'initial', implying that it is somehow obvious that they are
> reserved, although it is only obvious if you've read CSS3 Values And
> Units...)

You could rewrite the definition as

Value: [ [ <family-name> | <generic-family> ] [ , <family-name> |
>    <generic-family> ]* ] | inherit | initial | default;
>  <generic-family>: serif | sans-serif | cursive | fantasy | monospace;
>  <family-name>: STRING | IDENT+;  /* see restriction below */

Actually, all properties accept "initial" / "inherit" / "default"  *on
their own*, and they're never matched by property-specific grammars
(<family-name> for example). So "font-family:initial" uses the initial
font, and "font-family: initial, serif" searches a font called
"Initial", then uses the standard serif font.

>>
>> zw
>>
>> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=481502 (note that
>> the initial discussion is about font: rather than font-family:, but
>> the requested change would affect both, and is easier to explain in
>> terms of the longhand notation).
>
>
>
> Bert
> --
>  Bert Bos                                ( W 3 C ) http://www.w3.org/
>  http://www.w3.org/people/bos                               W3C/ERCIM
>  bert@w3.org                             2004 Rt des Lucioles / BP 93
>  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
>
>
Received on Wednesday, 22 April 2009 13:50:17 GMT

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