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

On Thu, May 10, 2012 at 12:21 PM, John Daggett <jdaggett@mozilla.com> wrote:
> Proposed new definition of 'font-family' in CSS3 Fonts:
>
>    font-family: <font-family-list> | inherit;
>
>  where
>
>    <font-family-list> == [ <string> | <user-ident>+ ]#

Drop the "| inherit", as that's incomplete (it's missing the
'initial'), and it's covered generically by V&U.  Then you can just
pull the <font-family-list> back up into the main definition:
"font-family: [ <string> | <user-ident>+ ]#;".


>  Here <user-ident>+ represents either a generic font family or an
>  unquoted font family name.  The following generic family keywords
>  are defined: ‘serif’, ‘sans-serif’, ‘cursive’, ‘fantasy’, and
>  ‘monospace’. These keywords can be used as a general fallback
>  mechanism when an author's desired font choices are not available.
>  As keywords, they must not be quoted. Authors are encouraged to
>  append a generic font family as a last alternative for improved
>  robustness.

Replace "As... quoted." with "Note that the generic font names can
*only* be expressed as keyword; using a string like e.g. "serif" will
attempt to use a font named "serif", rather than the browser's default
serif font."

>  Font family names that happen to be the same as a generic family
>  name must be quoted to prevent confusion with the keywords with the
>  same names.

Not sure if this line is still useful given my previous suggested
edit, but it might still be okay.

>  As with other user-defined identifiers, reserved keywords such as
>  'inherit', 'initial' or 'default' are not permitted within unquoted
>  font family names.  The use of these within unquoted family names
>  must be treated as invalid, so font family names containing these
>  keywords must be quoted.

I think this would read better as a note. It doesn't actually express
any new conformance requirements, it's just pointing out existing
requirements from other specs.  Maybe something like:

"Note: The global reserved keywords (currently 'inherit', 'initial',
and 'default', see V&U for details) are not valid user-defined
identifiers; attempting to use one of them will either make the
property invalid or accidentally invoke the special behavior those
keywords represent.  If a font's name actually includes one of those
words, specify it as a string instead.

> This also means most punctuation
>  characters and digits at the start of each token must be escaped in
>  unquoted font family names.

"This also means..." reads like it's referring to the bit about
reserved keywords, when it's actually supposed to refer to the fact
that this is a <user-ident>.  Maybe replace with "Also, because these
are identifiers, most punctuation characters and digits at the start
of each token must be escaped."

>  For unquoted font family names, the computed value is the name
>  converted to a string by joining all the identifiers in the sequence
>  by single spaces.
>
>  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-family: Hawaii 5-0, sans-serif;

I recommend using a comment after each to explain why they're invalid, like:

font-family: Red/Black, sans-serif;
font-family: Ahem!, sans-serif;
font-faimly: test@foo, sans-serif;
font-family: #POUND, sans-serif;
/* The /, @, !, or # characters aren't valid in <user-ident>s. */
font-family: "Lucida" Granda, sans-serif;
/* You can't mix <string> and <user-ident> in a single font name. */
font-family: Hawaii 5-0, sans-serif;
/* A <user-ident> can't start with a digit. */

> Within the value syntax for the 'font' shorthand, in place of
> '<font-family>' the '<font-family-list>' defined above would be used.

As I suggested above, we should we able to drop this.

~TJ

Received on Thursday, 10 May 2012 13:19:29 UTC