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

On Wed, Mar 24, 2010 at 1:12 AM, fantasai <fantasai.lists@inkedblade.net> wrote:
> On 04/22/2009 06:43 AM, 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.
>
> Proposed changes:
>
> Replace the paragraphs
>  # If an unquoted font family name ... converted to a single space.
> with the following text:
>
>  | Font family names must either given quoted as strings_, or unquoted as
>  | a sequence of one or more identifiers_. This means most punctuation
>  | characters and digits at the start of each token must be escaped in
>  | unquoted font family names.
>  |
>  | For example, the following declarations are invalid:
>  |
>  |   font-family: Red/Black, sans-serif;
>  |   font-family: "Lucida" Grande, sans-serif;
>  |   font-family: Ahem!, sans-serif;
>  |   font-family: test@foo, sans-serif;
>  |   font-family: #POUND, sans-serif;
>  |   font-fmaily: Hawaii 5-0, sans-serif;
>  |
>  | If a sequence of identifiers is given as a font family name, the
>  | computed value is the name converted to a string by joining all the
>  | identifiers in the sequence by single spaces.
>  |
>  | To avoid mistakes in escaping, is recommended to quote font family
>  | names that contain white space, digits, or punctuation characters
>  | other than hyphens:
>  |
>  | body { font-family: "New Century Schoolbook", serif }
>  | <BODY STYLE="font-family: '21st Century', fantasy">
>  |
>  | .. `strings`: http://www.w3.org/TR/CSS21/syndata.html#strings
>  | .. `identifier characters`:
> http://www.w3.org/TR/CSS21/syndata.html#characters
>
> (I would also suggest tucking the whole thing under the <family-name>
> type definition.)
>
> Note that this changes the prose to be more in line with the Appendix G
> grammar, and thus introduces additional constraints that were not in the
> prose before. Most of them are already honored by a majority of the UAs,
> though. (Arron and I checked.)

I approve.  Seems very clear.

~TJ

Received on Wednesday, 24 March 2010 15:46:52 UTC