[css3-fonts] revised definition of font-family

Current definition of 'font-family' within CSS3 Fonts spec:

font-family
Value:  [[ <family-name> | <generic-family> ] [, <family-name> | <generic-family>]* ] | inherit

Using the hash-mark convention described in CSS3 Values and Units,
along with the changes related to the use of identifiers [1],[2] to
define unquoted family names, this can be stated more simply.  This
definition should resolve ambiguities related to the use of reserved
keywords within unquoted font family names.

Proposed new definition of 'font-family' in CSS3 Fonts:

    font-family: <font-family-list> | inherit;
  
  where 
  
    <font-family-list> == [ <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.

  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.

  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.  This also means most punctuation
  characters and digits at the start of each token must be escaped in
  unquoted font family names.

  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;
  
  To avoid mistakes in escaping, it is recommended to quote font
  family names that contain digits or punctuation characters other
  than hyphens:
  
    body { font-family: "21st Century Schoolbook", serif }
  
    <BODY STYLE="font-family: 'M+ 1m', fantasy">
  
  Font family names are matched case insensitively.  User agents must
  match only family names (e.g. "Helvetica")and not the names of
  individual faces (e.g. "Helvetica Bold" or "Helvetica-Bold").  Some
  font formats such as OpenType allow fonts to carry multiple
  localizations of the family name (e.g. "ヒラギノ明朝 ProN"). User agents
  must recognize and correctly match all of these names independent of
  the underlying platform localization, system API used or document
  encoding.

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

Note: I am *not* proposing this change for CSS 2.1.
  
Regards,

John Daggett

[1] http://lists.w3.org/Archives/Public/www-style/2012May/0311.html
[2] http://lists.w3.org/Archives/Public/www-style/2012May/0364.html

Received on Thursday, 10 May 2012 10:22:24 UTC