- From: Gérard Talbot <www-style@gtalbot.org>
- Date: Wed, 14 Mar 2012 14:26:13 -0400
- 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 : Simon, 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 http://lists.w3.org/Archives/Public/public-css-testsuite/2011Feb/0116.html 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;} #quoted { font-family: "White Space"; } #unquoted { font-family: White Space; } #unquoted-spaces-before { font-family: White Space; } #unquoted-spaces-between { font-family: White Space; } #unquoted-spaces-after { font-family: White Space ; } #unquoted-spaces-all { font-family: White Space ; } </style> <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; " http://www.w3.org/TR/CSS21/fonts.html#font-family-prop 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 Gérard -- CSS 2.1 Test suite RC6, March 23rd 2011 http://test.csswg.org/suites/css2.1/20110323/html4/toc.html Contributions to CSS 2.1 test suite http://www.gtalbot.org/BrowserBugsSection/css21testsuite/ Web authors' contributions to CSS 2.1 test suite http://www.gtalbot.org/BrowserBugsSection/css21testsuite/web-authors-contributions-css21-testsuite.html
Received on Wednesday, 14 March 2012 18:26:48 UTC