Last Comment Bug 642008 - Courier font defaults to variable-spaced serif font instead of to monospace
: Courier font defaults to variable-spaced serif font instead of to monospace
Status: RESOLVED FIXED
: regression, testcase
Product: Core
Classification: Components
Component: Layout: Text (show other bugs)
: unspecified
: x86_64 Windows 7
: -- normal (vote)
: ---
Assigned To: Nobody; OK to take it and work on it
:
Mentors:
Depends on: 642093
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-15 16:54 PDT by Nathan
Modified: 2011-04-21 07:42 PDT (History)
4 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
testcase (187 bytes, text/html)
2011-03-15 19:27 PDT, j.j.
no flags Details

Description Nathan 2011-03-15 16:54:18 PDT
User-Agent:       Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0) Gecko/20100101 Firefox/4.0

If font-family for a text-containing element is set to Courier, and the Courier font is not available, it should default to a monospace font (Courier New by default).  Courier falls back to Courier New in previous versions of Firefox, as well as in IE and Chrome.

In Firefox 4, it is instead shown as an unknown (to me) variable-spaced serif font.

Reproducible: Always

Steps to Reproduce:
1. Set the font-family of a text-containing block to 'courier'

Actual Results:  
If the courier font is not installed on the computer (which it is not by default on Windows), a variable-spaced serif font is used instead.

Expected Results:  
The default monospace font, Courier New, should be used.
Comment 1 j.j. 2011-03-15 19:18:05 PDT
(In reply to comment #0)
> Courier falls back to Courier New in previous versions of Firefox,
> as well as in IE and Chrome.

Cannot confirm fallback to "Courier New" in Fx 3.6 and Opera 11.
Falls back in Chrome and IE8. Have you tested in IE9 strict mode?

This is IMHO what Mozilla did always an what CSS spec requires.
Probably INVALID but useful for compatibility.
Comment 2 j.j. 2011-03-15 19:27:09 PDT
Created attachment 519579 [details]
testcase
Comment 3 Nathan 2011-03-15 19:38:14 PDT
It seems like it should fall back to whatever is set as the default monospace font in the content options.  By default that is Courier New.

Verified that IE9 standards does fall back.  So does my copy of FF 3.6.14.
Comment 4 Boris Zbarsky [:bz] (TPAC) 2011-03-15 21:21:55 PDT
> It seems like it should fall back to whatever is set as the default monospace

No, it should fall back to whatever the next thing listed in font-family is, an to the user's default font otherwise.  There's nothing that says "Courier" is a monospace font; it's just a font name.  If you want fallback to monospace, just say so in your CSS.

For the rest of it, I'm surprised that IE9 falls back to Courier New...  Jonathan?

Oh, and 3.6 probably just finds a Courier font on your system and uses it, but DirectWrite can't handle bitmap fonts, so doesn't know anything about Courier.
Comment 5 Nathan 2011-03-15 22:38:21 PDT
Sorry, my mistake on the default monospace font bit.  I do understand that good CSS would list alternate fonts in the font-family, but unfortunately not all pages do so.

Anyway, it's all the same to me - just though I would report it since the current behavior seemed inconsistent with other major browsers and earlier versions of Firefox.
Comment 6 Nathan 2011-03-15 22:40:45 PDT
Just did another search for dups and found this one that I missed originally, which appears to cover the same issue: https://bugzilla.mozilla.org/show_bug.cgi?id=641860
Comment 7 Boris Zbarsky [:bz] (TPAC) 2011-03-15 22:41:34 PDT
Right, hence my question for Jonathan about IE9....
Comment 8 Jonathan Kew (:jfkthame) 2011-03-16 00:10:09 PDT
I don't know this for a fact, but I strongly suspect that IE9 has implemented substitutions for some of the bitmap-only fonts from older versions of Windows; e.g. Courier -> Courier New, MS Sans Serif -> Microsoft Sans Serif, etc.

This would be a logical extension of the substitutions that are typically defined in the Windows registry, such as Times -> Times New Roman, Helvetica -> Arial. We already read the FontSubstitutes key and build a mapping of these names; under DirectWrite, I suspect IE9 is adding similar mappings for certain "well-known" bitmap fonts, and I suggest we could do the same.
Comment 9 j.j. 2011-03-16 09:40:28 PDT
This is de facto a regression, adding that keyword.
Comment 10 Jonathan Kew (:jfkthame) 2011-03-16 09:47:56 PDT
I have filed bug 642093 about mapping specific Windows bitmap font names to TrueType equivalents under DirectWrite, and posted a patch there; if this is accepted it will "fix" the issue here (and similar reports about other fonts).
Comment 11 j.j. 2011-04-21 07:42:24 PDT
Fixed with bug 642093 for Fx5

Note You need to log in before you can comment on or make changes to this bug.