Default of Times font is ignored on some (bad) websites, and renders Zeal font




10 years ago
9 years ago


(Reporter: c_barrows, Assigned: jtd)


({fixed1.9.1, regression})

Mac OS X
fixed1.9.1, regression
Bug Flags:
blocking1.9.1 +

Firefox Tracking Flags

(Not tracked)




(5 attachments, 2 obsolete attachments)



10 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv: Gecko/2008070206 Firefox/3.0.1
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv: Gecko/2008070206 Firefox/3.0.1

On badly scripted websites, instead of Times font being displayed, I get Zeal (arrows and triangles).  Nobody else seems to get this, so I've put examples at three pages:

Reproducible: Always

Steps to Reproduce:
1. In preferences>Content set the default font to Times
2. Visit a badly scripted website
3. See Zeal font
Actual Results:  
Zeal font is rendered instead of Times

Expected Results:  
Should see text correctly in Times font

I have put screen-shots of my Firefox Preferences at:

Comment 1

10 years ago
The bad websites render in Times font correctly in Firefox, Safari, Camino, Netscape Navigator and Opera.
ccing some folks who might know what info we need here.
Assignee: nobody → joshmoz
Component: Preferences → GFX: Mac
Product: Firefox → Core
QA Contact: preferences → mac
Reporter, can you please put a URL that the problem shows up on in the URL field?

Comment 4

10 years ago
URL changed, as requested

Comment 5

10 years ago
I have been looking at ways to solve this within the Mac applications
user group, and went on to look at checking the spellings of the
various Times fonts and validating them with Apple Font Book.  On
looking at the file in Font Book, I realised that there was one called
'Times-Roman C', which was buried away in a folder in my user files,
and hadn't been used for years.  It was specifically designed to print
strange foreign font characters, as in the composers Dvorak and
Janacek.  Like all the rest of the Times font family, it validated
with absolutely no problems.  However, I have compressed it, to make
it unavailable, and suddenly Firefox now recognises the standard Times

So, it was a problem on my Mac, which caused Firefox 3.0.1 not to be
able to understand 'Times-Roman C', even though Firefox and
all the other browsers had no problems - and still do not, having
removed the offending font.

Of course, there is still the issue that Firefox 3.0.1 isn't as
forgiving/tolerant as Firefox

Comment 6

10 years ago
Firefox 3 uses Cocoa to decide how font families are grouped together, while Firefox 2 used Quickdraw which groups fonts differently.  My guess is that the funky face Times-Roman C ends up in a separate family under Firefox 2.  You can confirm this by browsing the list of fonts in the Default Font popup menu in the prefs.

Same weird behavior will happen if you add in Helvetica Fractions, a Type1 font in Adobe's library.  Both Firefox 3 and Safari will render in a very crazy way until you remove or disable that font.

BTW, no need to compress your font, simply disable it in FontBook.

Unless you're still running into a problem, could you resolve this as invalid?
John: I don't understand why you think this is INVALID; Firefox 3 is choosing the wrong font, whereas Safari, Camino and Opera are choosing the right one. Or are you saying that these other applications are broken?
c_barrows, would you be willing to attach the problem font to this bug?
And yeah, comment 7 seems spot-on.  Confirming pending some real investigation here.
Ever confirmed: true
Flags: blocking1.9.1?
Keywords: regression

Comment 10

10 years ago
Created attachment 339056 [details]
Font (designed in 1999) producing some eastern European characters

The presence of this font (filed in a user font folder, away from most other fonts) caused Firefox 3.0.1 to avoid 'Times' default font altogether, and default to the bottom of the alphabetical list e.g. Zeal, or (if Zeal was removed) to Zapfino.  It caused no trouble to Firefox or other browsers.
--> GFX: Thebes per Vlad

What appears to be happening here is that when there's no additional CSS or font properties set on an element, and when Times is selected as the default proportional font, our code is (for some reason) selecting Times-Roman C. While I get that might be due to the change in font family selection APIs we're using, what I don't understand is:

 - why only when no CSS / font properties are selected?
 - what in Times-Roman C is causing the misselection?
Assignee: joshmoz → nobody
Component: GFX: Mac → GFX: Thebes
QA Contact: mac → thebes
And the third question is:

 - Why are we falling back from Times-Roman C to the last font alphabetically
   instead of something saner when we can't find the chars we need?

(or at least I assume that's why we end up using Zeal or Zapfino).

Mike, I assume that "font-family: Times" makes the bug go away, based on your comment?

Comment 13

10 years ago
The attachment is an empty folder, looks like an old pre-Mac OS X font suitcase.  To attach it you probably need to put it into an archive using Disk Utility.  But it's probably simpler to just grab some logfiles in your environment and investigate based on that.

Clive, when you have a chance could you try running with a special build of Firefox I put together?  It has some logging enabled that will spit out information about the fonts on your system and which fonts are matched when rendering pages.


1. Reenable the strange 'Times Roman C' font

2. Download try server build with mac font logging enabled:

3. Copy the app, "Minefield" to your desktop (this is the name for dev versions of Firefox).

4. Quit Firefox, if it's already running

5. Open a Terminal window and enter these commands:

     cd Desktop
     export NSPR_LOG_MODULES=atsuiTextRun:5,fontInfoLog:5
     export NSPR_LOG_FILE=fontinfo.out
6. When the browser window opens, enter the testcase URL:

7. Quit Minefield

You should see a file called fontinfo.out in the directory: 

    ls fontinfo.out
To see the flavors of Times fonts you have:

     grep '(fontinit)' fontinfo.out | grep Times

To see which fonts were matched:

     tail -100 fontinfo.out
You should see information something like:

(fontinit) family: Times, psname: Times-Roman, face: Regular, apple-weight: 5, css-weight: 4, traits: 01000004
(fontinit) family: Times, psname: Times-Italic, face: Italic, apple-weight: 5, css-weight: 4, traits: 00000005
(fontinit) family: Times, psname: Times-Bold, face: Bold, apple-weight: 9, css-weight: 7, traits: 01000002
(fontinit) family: Times, psname: Times-BoldItalic, face: Bold Italic, apple-weight: 9, css-weight: 7, traits: 00000003

InitTextRun 26d5400 fontgroup 16d1a9d0 (serif) lang: x-western len 139 TEXTRUN "Plethora products pour down our toilets sinks way enzymes operate friendly market kick bacterial failing odd dead cat road kill get moving." ENDTEXTRUN
InitTextRun font: Times-Roman
InitTextRun 26d5400 fontgroup 16d1a9d0 font 17013730 match Times-Roman (0-139)

The "match xxx (yy-zz)" means that font xxx was matched from characters starting at the yy-th character for a length of zz characters in the TEXTRUN string directly above.

If you could attach the resulting fontinfo.out file to this bug that would be great. Also, what are the names of Times fonts that are listed in the default fonts popup in the prefs dialog for *Firefox 2*?

Comment 14

10 years ago
My guess is that Times is mapping to the Times-Roman C font, which does not contain Latin-1 characters in its character map.  Normal font fallback is (1) fonts specified in the stylesheet (2) pref font based on the character range and (3) system-wide fallback.  The testcase page doesn't specify the font-family so normally you would use the default pref font, namely Times.  

But in this instance, the Cocoa API we use is providing us with two "normal" faces, so the last one is the one we'll use.  We can distinguish things like fixed-width fonts, condensed fonts, etc. but two fonts that have the same weight, width and style will in effect collide.  Firefox 2 used a Quickdraw API which groups font families differently.  FontBook reflects how Cocoa APIs group fonts.

Under normal circumstances, system-wide font fallback should never occur for Latin-1 characters, since they will all be contained in the normal version of Times which is the default pref font under Mac OS X.  During system-wide font fallback, we attempt to rank each font by how close its style matches the style we're looking for.  With "normal style" and a Latin-1 character you're going to hit almost every font on the system.  Ties are broken using the font name which is why in this case you end up with Zeal. 

Having old fonts around that belong to the Helvetica or Times families is a known problem on the Mac:

There's an app specifically for dealing with managing font problems like this, called Font Finagler:

Note one of its features:

"Adds a “Problem Fonts” feature: when you launch Font Finagler, it automatically checks the active fonts on your Mac, and if it identifies any that are known to cause problems, such as Helvetica Fractions or Times Phonetic, it’ll alert you of this. To aid in troubleshooting, Font Finagler provides information about the font’s name, type, location of the font files, and what font manager application (if any) is responsible for activating the font. It also provides the ability to reveal the font files in the Finder and to deactivate the problematic fonts."

Comment 15

10 years ago
Example of Safari rendering with Helvetica Fractions enabled:

Similar bad craziness.

Comment 16

10 years ago
Note that one way for us to explicitly work around this problem is to run through a list of "known" system fonts and explicitly eliminate "non-standard" faces for font families like Times and Helvetica.  I seem to remember seeing this sort of thing in Webkit code.  The tradeoff is that we will spend a little more time dilly-dallying on startup to solve a relatively rare problem.

Comment 17

10 years ago
Created attachment 339211 [details]
Terminal test info   &   Firefox Preference Times fonts

In response to John Daggett's request, I've attached what I can from Terminal (but I'm not used to using this).  I got as far as item 7, quitting Minefield, but I didn't know where to find the 'directory'.  So I just put in "ls", and this is what came up.  Also the Firefox 2 fonts for Times in Preferences.

Comment 18

10 years ago
Sorry the Times-Roman C font file was empty - very strange, but I haven't used it for years.  It was, indeed, made for OS 9, and I've never used since (but it hadn't caused any problems).

Comment 19

10 years ago
The list of fonts from Firefox 2 confirms that Quickdraw separates out Times-Roman C into a separate family.  Now we just need to confirm the font family groupings that Cocoa is providing us.

Clive, when you enable Times-Roman C what shows up in FontBook under "Times"?  Is Times-Roman C listed as a member of the Times family?

Comment 20

10 years ago
Yes Roman C is listed under Times, within FontBook.  The family is listed as:
 Roman C (with the leading space)
Bold Italic

Comment 21

10 years ago
Created attachment 339416 [details]
Terminal oupput file from '', as requested by John Daggett 

In response to Comment #13, having been talked through the use of Terminal by John Daggettt (thank you), the output file from his '' is attached.

Comment 22

10 years ago
Times faces on user's machine with Times-RomanC enabled:

family: Times, psname: Times-RomanC, face:  Roman C, weight: 4, traits: 01000004
family: Times, psname: Times-Roman, face: Regular, weight: 4, traits: 01000004
family: Times, psname: Times-Italic, face: Italic, weight: 4, traits: 00000005
family: Times, psname: Times-Bold, face: Bold, weight: 7, traits: 01000002
family: Times, psname: Times-BoldItalic, face: Bold Italic, weight: 7, traits: 00000003
Marking this as blocking; we'll need to figure out a way to handle these fonts.  One simple workaround might be to have a list of "known" faces and always order those higher than any unknown faces.. this putting " Roman C" lower than reg/italic/bold/bold italic.  Would that work as a bandaid?
Flags: blocking1.9.1? → blocking1.9.1+
Priority: -- → P3


10 years ago
Assignee: nobody → jdaggett
Comment on attachment 339056 [details]
Font (designed in 1999) producing some eastern European characters

The included suitcase file is 0-bytes in size here, marking attachment as obsolete :)
Attachment #339056 - Attachment is obsolete: true
Created attachment 355178 [details] [diff] [review]
maybe something like this?

John, could something like this work?  I don't have a way to test it, though if someone can give me some STR with a different font I can give it a shot.
Attachment #355178 - Flags: review?(jdaggett)

Comment 26

9 years ago
Created attachment 355363 [details]
font, TimesRomanC based on Vera Sans with name table changed to testcase font name

Created a font to match the reporter's font.  Used Vera Sans, changed name table to match testcase font (family: Times, face: Times  RomanC), stripped out lowercase codepoints from cmap.

Comment 27

9 years ago
Created attachment 355365 [details]
font, name altered to be the last one alphabetically

Based on Plum Script by Dieter Steffmann (  Changed name table to use 'zzPlum Script'.

In the Windows/Mac font matching process fonts are matched based on the style fontlist, pref fonts, and system fallback fonts.  During system fallback, when multiple fonts of the exact same style are present the last one alphabetically is chosen, hence for missing Latin alphabet codepoints, zzPlum Script glyphs will end up getting used.

Comment 28

9 years ago

Assumption: default font set to Times

1. Copy the two attached fonts into ~/Library/Fonts
2. Start Firefox
3. Enter the URL below


Expected result: should see 'abcd' in Times

Actual Result: see 'abcd' in script font

The first attached fonts mimics the strange Times RomanC font the reporter had on his machine.  The face name was such that it would be selected first, effectively hiding the regular system Times Roman face.  Since it lacks cmap entries for 'abcd' fallback occurs and the last font found for a particular glpyh is used.
Kicked patch off to try server to see if Ts changes.. though I doubt the try machines have a lot of fonts installed.
Try server doesn't seem to show any difference in Ts with this patch
If the default (pref) family has multiple fonts with the same attributes but different character support, then should all of these fonts be tried, rather than trying only one font before trying a font from a different family?

Comment 32

9 years ago
(In reply to comment #31)
> If the default (pref) family has multiple fonts with the same attributes but
> different character support, then should all of these fonts be tried, rather
> than trying only one font before trying a font from a different family?

I don't think cmap differences are the only consideration here.  The problem is preventing "funky" faces from influencing standard faces, the fact that the font in this case is the default font makes it especially deadly but the same might happen with a face like 'Helvetica Fractions', sites that include Helvetica in a font-family list would suddenly end up spewing fractions all over the page.  Although not bulletproof, the patch here prevents most cases of this happening.

Comparing cmap's sounds expensive, especially for large families (e.g. Adobe's Minion Pro with 64 faces), and I'm guessing 99% of the time they will be the same for well-designed fonts.


9 years ago
Attachment #355178 - Flags: review?(jdaggett) → review+

Comment 33

9 years ago
Comment on attachment 355178 [details] [diff] [review]
maybe something like this?

+            const char *faceName = [[face objectAtIndex:INDEX_FONT_FACE_NAME] UTF8String];

+            if (strcmp(faceName, "Regular") == 0 ||
+                strcmp(faceName, "Bold") == 0 ||
+                strcmp(faceName, "Italic") == 0 ||
+                strcmp(faceName, "Oblique") == 0 ||
+                strcmp(faceName, "Bold Italic") == 0 ||
+                strcmp(faceName, "Bold Oblique") == 0)
+            {
+                isStandardFace = PR_TRUE;
+            }

Seems like you'd get better performance with:

  NSString *faceName = [face objectAtIndex:INDEX_FONT_FACE_NAME];
  if ([faceName isEqualToString:@"Regular"] ||
      [faceName isEqualToString:@"Bold"] ||
That would avoid the extra UTF8String call per face.      

Otherwise looks good.
Created attachment 356139 [details] [diff] [review]
updated patch, with the NSString usage

Updated patch, with suggested NSString usage.
Attachment #355178 - Attachment is obsolete: true
Attachment #356139 - Flags: review+
Checked in.
Last Resolved: 9 years ago
Resolution: --- → FIXED

Comment 36

9 years ago
Checked in on 1.9.1
Keywords: fixed1.9.1


9 years ago
Depends on: 478179
Verified Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-US; rv:1.9.1pre) Gecko/20090527 Shiretoko/3.5pre
You need to log in before you can comment on or make changes to this bug.