Closed Bug 642008 Opened 9 years ago Closed 9 years ago

Courier font defaults to variable-spaced serif font instead of to monospace


(Core :: Layout: Text and Fonts, defect)

Windows 7
Not set





(Reporter: nathan, Unassigned)



(Keywords: regression, testcase)


(1 file)

187 bytes, text/html
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.
(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.
Component: General → Style System (CSS)
Product: Firefox → Core
QA Contact: general → style-system
Attached file testcase
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.
> 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.
Component: Style System (CSS) → Layout: Text
QA Contact: style-system → layout.fonts-and-text
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.
Just did another search for dups and found this one that I missed originally, which appears to cover the same issue:
Right, hence my question for Jonathan about IE9....
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.
Depends on: 642093
This is de facto a regression, adding that keyword.
Keywords: regression, testcase
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).
Fixed with bug 642093 for Fx5
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.