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

[CSS21] [css3-font] unquoted font family names with whitespace

From: Gérard Talbot <www-style@gtalbot.org>
Date: Wed, 14 Mar 2012 14:26:13 -0400
Message-ID: <e3a938376b2296c6516426d77f98f5be.squirrel@ed-sh-cp3.entirelydigital.com>
To: "Simon Pieters" <simonp@opera.com>
Cc: "www-style mailing list" <www-style@w3.org>

Le Mer 14 mars 2012 2:52, Simon Pieters a écrit :


I have modified the subject line as this is CSS21 material.

> "To avoid mistakes in escaping, it is recommended to quote font family
> names that contain white space, digits, or punctuation characters other
> than hyphens:"
> http://dev.w3.org/csswg/css3-fonts/#propdef-font-family
> http://www.w3.org/TR/CSS21/fonts.html#font-family-prop
> What mistake in escaping can one do when a font family name contains
> whitespace? Whitespace doesn't need escaping (unless a font has something
> funny like a tab character or two subsequent spaces, but such fonts don't
> exist).

Such sentence is more about valid syntax, grammar than about possible font
names that exist.
I have proposed corrections to font-family-rule-002

I now think the font-family-rule-002 test should be a lot more exhaustive
with combinations, possibilities of white spaces and absence of quotes:

        <style type="text/css">
        div {font-size: 1em; line-height: 1.5;}

        font-family: "White Space";

        font-family: White Space;

        font-family:        White Space;

        font-family: White       Space;

        font-family: White Space       ;

        font-family:        White        Space       ;

<p>Test passes if there are 6 small filled black rectangles.</p>

        <div id="quoted">FAIL</div>

        <div id="unquoted">FAIL</div>

        <div id="unquoted-spaces-before">FAIL</div>

        <div id="unquoted-spaces-between">FAIL</div>

        <div id="unquoted-spaces-after">FAIL</div>

        <div id="unquoted-spaces-all">FAIL</div>

> Unquoted font family names with spaces work fine. Don't recommend
> quoting them.
> Unescaped unquoted font family names that start with a digit or contain
> punctuation characters other than hyphen will break *even if there is no
> whitespace*.

For example, the following declarations are invalid:

font-family: Hawaii 5-0, sans-serif;

The font-family name Hawaii 5-0 contains 1 white space and 1 hyphen and it
is invalid.

> Suggested wording:
> To avoid mistakes in escaping, it is recommended to quote font family
> names that contain words that start with digits or contains punctuation
> characters other than hyphens:

If an unescaped unquoted font-family name starts with an hyphen followed
by a digit, then it will be invalid syntax. If it starts with 2 hyphens,
it should be invalid.

> body { font-family: "Amalgamate O (outlined)", serif }
> <BODY STYLE="font-family: '21st Century', fantasy">
> --
> Simon Pieters
> Opera Software

I think the punctuation characters themselves should be listed, otherwise
a few of them, the most common ones: !, #, /, -, @, ?, $, etc

CSS 2.1 Test suite RC6, March 23rd 2011

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Wednesday, 14 March 2012 18:26:48 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:57 UTC