Re: [css3-fonts] revised definition of font-family

fantasai wrote:

> counter-reset accepts sequences of identifiers.

The production used is not the same:

  font-family: [ <string> | ident+ ]# | inherit
  counter-reset: [ <identifier> <integer>? ]+ | none | inherit

Yes, both could match the same sequence of identifiers but the grammar
implies very different handling.  With 'counter-reset' the identifiers
are treated as distinct entities, so they aren't like unquoted font
family names.

Ex:

  font-family: foo bar, sans-serif;
  counter-reset: foo bar;

In the font-family case 'foo bar' forms a single entity while in the
counter-reset case it represents two entities 'foo' and 'bar'.

> font-family is the only place where sequences of identifiers are joined
> together and treated as a string.
> 
> If it's going to allow reserved keywords, then it needs its own identifier
> type and can't use the generic one in Values and Units.

Right, I'm thinking that since unquoted font family names are their
own special little thing that trying to "unify" it with other
identifiers used in completely different contexts (i.e. user-defined
identfiers) justs muddles things up even more.

As others have noted, banning reserved keywords anywhere in unquoted
font family names leads to inconsistencies like the ones below, where
one rule is valid but the other not:

  font-family: foo sans-serif;  /* valid, sans-serif is generic but not reserved */
  font-family: foo inherit;     /* invalid, inherit is a disallowed reserved keyword */

> But there is little interop on the use of reserved keywords as part
> of an unquoted font name, it's a very uncommon case, and I don't see
> a good reason to make parsing more complicated here than it
> absolutely needs to be.

There isn't much interop but I don't see that allowing 'foo inherit'
as an unquoted font family name is making implementations any more
complicated, it simply changes where the test for reserved words
occurs (i.e. testing the identifier 'foo' and 'bar' vs. testing 'foo
bar').

Cheers,

John Daggett

Received on Wednesday, 16 May 2012 08:10:45 UTC