Closed Bug 467250 Opened 11 years ago Closed 11 years ago

Cannot find/use some typical OS/2 fonts

Categories

(Core :: Preferences: Backend, defect, major)

x86
OS/2
defect
Not set
major

Tracking

()

RESOLVED FIXED

People

(Reporter: mozilla, Assigned: mozilla)

Details

(Keywords: fixed1.9.1)

Attachments

(1 file, 2 obsolete files)

Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9.1b3pre) Gecko/20081128 SeaMonkey/2.0a2pre

As noted by Walter Meinl in mozilla.dev.ports.os2 after running this build for a while and opening multiple windows, everything is displayed in a wrong font. On my system this seems to be Helvetica (to which the last-resort fallback of Helv resolves).

I so far traced this to gfxFontconfigUtils::IsExistingFamily that after a while seems to report all families as non-existing. As if the mFontsByFamily table was cleared, but I don't see any code that does this... The line mFontsByFamily.Clear() in gfxFontconfigUtils::UpdateFontListInternal is only hit ones at startup.
Other people in the newsgroup report seeing a serif font for the menus instead. Not sure how related that is...

It is also not clear if this is related to messages like
   WARNING: Textrun cache not empty!: 'mCache.Count() == 0',
      file <path>/gfxTextRunWordCache.cpp, line 69
   WARNING: Fonts still alive while shutting down gfxFontCache:
      'mFonts.Count() == 0', file ../../../dist/include/thebes/gfxFont.h, line 271
   Assertion failed at <path>/gfx/cairo/cairo/src/cairo-hash.c:199:
      hash_table->live_entries == 0
that appear at the end of a session with a debug build.
I finally found some time to further look at this. First I noted that the debug build doesn't I think it's again a problem of our FontConfig port, something I messed up already a while ago when adding and then "fixing" FcConfigGetCurrent() in changeset 52:7bb863af59fb.

Changeset 56:feb6bca9775c (http://hg.mozilla.org/users/mozilla_weilbacher.org/mzfntcfgft/rev/feb6bca9775c) should finally fix the problem, at least it hasn't reoccurred for me.

I also linked a thebes.dll with the change and uploaded as <http://temp.weilbacher.org/sm20081214015000_thebes.zip>. This should work with the latest SM nightly.

If testers agree that this fixes the problem, we can mark this invalid.
Args, sent comment 2 when half of a sentence was still missing...

(In reply to comment #2)
> First I noted that the debug build doesn't
display any of the WARNINGs any more. So that was really caused by something different.

> I think it's again a problem of our FontConfig port
[...]
(In reply to comment #2)
> I finally found some time to further look at this. First I noted that the debug
> build doesn't I think it's again a problem of our FontConfig port, something I
> messed up already a while ago when adding and then "fixing"
> FcConfigGetCurrent() in changeset 52:7bb863af59fb.
> 
> Changeset 56:feb6bca9775c
> (http://hg.mozilla.org/users/mozilla_weilbacher.org/mzfntcfgft/rev/feb6bca9775c)
> should finally fix the problem, at least it hasn't reoccurred for me.
> 
I updated my local repository and recompiled fontconfig. As I had just finished a Minefield-3.2apre build I wiped out any lib and o files in thebes and removed xul.* in library, rebuilt against the new fontconfig/ft libs.
> I also linked a thebes.dll with the change and uploaded as
> <http://temp.weilbacher.org/sm20081214015000_thebes.zip>. This should work with
> the latest SM nightly.
>
Downloaded your thebes.dll and it worked with my build from a few days ago. 
> If testers agree that this fixes the problem, we can mark this invalid.
In Seamonkey with your thebes.dll and Minefield rebuilt against the new libs I don't see the "fontswitching" anymore, thus the new fontconfig fixes mozilla apps.
However, the regular font, e. g. when you load the Minefield or Seamonkey project page is now a serif font, in older OS/2 and current linux builds these sites are displayed with Sans serif fonts. The the menus are displayed properly with Worplace Sans. As I installed now eCS-2.0 RC6a I first thought this could be due to the missing Verdana fonts I had on my RC5 System installed. But as I said, when I tested an older build, the sites were displayed with a Sans serif font.
Right, when Verdana is deinstalled, Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9.1b2pre) Gecko/20081022 SeaMonkey/2.0a2pre shows a sans font when starting while Mozilla/5.0 (OS/2; U; Warp 4.5; en-US; rv:1.9.1b3pre) Gecko/20081214 SeaMonkey/2.0a3pre shows a serif font.

Will take some more debugging. (Strictly, this calls for a new bug, but let's leave this one open...)
Attached patch fake entries in FcFontList() (obsolete) — Splinter Review
Finally found the reason: Thebes now checks if a font exists on the system before trying to use it at all. That means that "Helv" and "Tms Rmn" will never get used (and also never be replaced by "Helvetica" and "Times New Roman"). We have two options:

- Change our FontConfig to get FcFontList() to fake additional entries
  of "Helv" and "Tms Rmn" (for all subfonts of "Helvetica" and "Times
  New Roman" that it encounters).
  I have done this (see this patch against our FC port), but it looks
  like this will cause new leaks...

- Change Gecko to not use "Helv" or "Tms Rmn" anywhere. This mainly
  means that we need to change gfxOS2Fonts.cpp and especially all.js.

Are there any webpages out there that use "Helv" and "Tms Rmn"? If so, then we should use the first approach and find a way to not leak.
(In reply to comment #6)
> - Change Gecko to not use "Helv" or "Tms Rmn" anywhere. This mainly
>   means that we need to change gfxOS2Fonts.cpp and especially all.js.

I think this makes the most sense.

> Are there any webpages out there that use "Helv" and "Tms Rmn"?

It seems unlikely...
Agreed, it's a lot cleaner, and here is the patch for that. But it doesn't really help much.

The problem is that it still never finds "Times New Roman" because the OS/2 version of that font is called "Times New Roman " (with trailing space), and so e.g. on the BBC pages I get everything displayed using "Times New Roman MT 30" which has the problem of double line space and neither bold nor italic...
Attachment #356424 - Attachment is obsolete: true
Oh my, why it again took so long for me to realize this I don't know. But this is exactly the reason the font.alias-list is there for. So let's update this with the font names that don't directly appear in the list.

At the same time we can shrink down the Unicode lists, and list only those fonts that are very likely to be there (the SIL fonts are not and the Code200x fonts are partly bad), because we match all remaining fonts automatically now.
Assignee: nobody → mozilla
Attachment #356442 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #356443 - Flags: review?(wuno)
Comment on attachment 356443 [details] [diff] [review]
update font alias list (and shrink down unicode lists)

The minefield project home page now shows sans serif fonts, though I don't have verdana installed. Monspaced fonts work as well, e.g. comments in bugzilla.
However when I uninstall Workplace Sans menu fonts are still in serif, compared to Firefox 3.0.x the Times Roman fonts of the menus are even bigger (eCS2.0RC6a). With installed Workplace Sans menus look ok.
Attachment #356443 - Flags: review?(wuno) → review+
(In reply to comment #8)
> The problem is that it still never finds "Times New Roman" because the OS/2
> version of that font is called "Times New Roman " (with trailing space), and 
> so e.g. on the BBC pages I get everything displayed using "Times New Roman MT 
> 30" which has the problem of double line space and neither bold nor italic...

I was wondering why changing all the prefs didn't help...

(In reply to comment #9)
> exactly the reason the font.alias-list is there for. So let's update this
> with the font names that don't directly appear in the list.
> 
> At the same time we can shrink down the Unicode lists

Great, this seems to get things back to how they were.
I don't think we should worry about what happens if "Workplace Sans" isn't installed. If the system menu font is WarpSans then any other font will look ugly. (Actually, I think the uglier the better because that might get more people to read README.txt and/or post in the newsgroup.)

Renaming the bug and resetting to the respective component to the only Mozilla internal problem that was discussed here.
Component: GFX: Thebes → Preferences: Backend
QA Contact: thebes → prefs
Summary: After running for a while gfxFontconfigUtils::IsExistingFamily doesn't find any more fonts → Cannot find/use some typical OS/2 fonts
Pushed to mozilla-central (http://hg.mozilla.org/mozilla-central/rev/0b56d4b6c7ea).
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment on attachment 356443 [details] [diff] [review]
update font alias list (and shrink down unicode lists)

OS/2 only change in cross-platform file.
Attachment #356443 - Flags: approval1.9.1?
Attachment #356443 - Flags: approval1.9.1?
Comment on attachment 356443 [details] [diff] [review]
update font alias list (and shrink down unicode lists)

This patch has been in mozilla-central for more than two weeks now without causing any problems. The changes are fully contained in an #ifdef XP_OS2 section. So this is "proven NPOTDB" even though it's in a cross-platform file. So I cancel the approval request.
You need to log in before you can comment on or make changes to this bug.