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

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

From: John Daggett <jdaggett@mozilla.com>
Date: Wed, 23 May 2012 18:13:06 -0700 (PDT)
To: www-style@gtalbot.org
Cc: www-style list <www-style@w3.org>
Message-ID: <958722593.19795078.1337821986777.JavaMail.root@mozilla.com>
GĂ©rard Talbot wrote:

> > (...) The original proposals were
> > outlined here:
> >
> >   http://lists.w3.org/Archives/Public/www-style/2012May/0630.html
> 
> > Proposed:
> >   Unquoted font family names that happen to be the same as the
> >   keyword values 'inherit', 'default' and 'initial' or the generic
> >   font keywords ('serif', 'sans-serif', 'monospace', 'fantasy',
> >   and 'cursive') do not match the '<family-name>' type. These
> >   names must be quoted to prevent confusion with the keywords with
> >   the same names. Note that 'font-family: Times, inherit' is
> >   therefore an invalid declaration, because 'inherit' in that
> >   position can neither be a valid keyword nor a valid font family
> >   name.
> 
> > [1] http://www.w3.org/TR/CSS21/fonts.html#font-family-prop
> 
> What about the other changes? Are there other changes? Wasn't there
> supposed to be other changes?
> Is this the new and approved CSS 2.1 font-family syntax:
> 
> font-family value: [ <string> | <ident>+ ]# | inherit

I think various other proposals were tossed around on the list,
including the idea of moving the hash notation back into CSS 2.1, but
we didn't discuss those on the call and that's not what we resolved
on.

I'm not in favor of pushing down the hash notation to 2.1 because I
think we should be doing those sorts of changes in CSS3 specs instead
and only making changes to CSS 2.1 that are absolutely
oh-my-god-we're-gonna-die-if-we-don't-do-this necessary. Regardless,
if someone want's to propose that we need to have the specific wording
for this before deciding whether to make that change.

> Is this test
> http://www.gtalbot.org/BrowserBugsSection/css21testsuite/font-family-rule-004a.xht
> still good for CSS 2.1?

With the wording above 'foo inherit' and 'inherit foo' are valid
unquoted font family names.  Only font lists containing 'foo, inherit'
and 'inherit, foo' would be invalid.

>   div#thirdTest {font-family: inherit foo, "CSSTest Fallback";} 
>   /* invalid now; one identifier is a pre-defined keyword value */
> 
>   div#fourthTest {font-family: foo inherit, "CSSTest Fallback";} 
>   /* invalid now; one identifier is a pre-defined keyword value */
> 
>   div#fifthTest {font-family: foo, inherit bar, "CSSTest Fallback";} 
>   /* invalid now; one identifier is a pre-defined keyword value */
> 
>   div#sixthTest {font-family: foo, bar inherit, "CSSTest Fallback";} 
>   /* invalid now; one identifier is a pre-defined keyword value */

Under the definition above, these are all valid.

I would also suggest including a matching set of these for the font shorthands
and including escapes in there as my tests seemed to indicate there's a wide
inconsistency in the handling of these.

  /* valid *
  font-family: foo inherit;
  font-family: inherit foo;
  font-family: \inherit foo;
  font-family: foo \inherit;
  font: 16px \inherit foo;
  font: 16px foo \inherit;
  font: caption;         /* system font */
  font: medium caption;  /* a font named 'caption' */

  /* invalid */
  font-family: foo, inherit;
  font-family: inherit, foo;
  font: caption foo;
  font: caption, foo;
  font: medium caption, inherit;
  font-family: --blah de blah, foo; /* double-hyphen ==> not permitted identifier format */
  font-family: 'blah' de blah, foo;

Cheers,

John Daggett
Received on Thursday, 24 May 2012 01:13:36 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:54 GMT