[Gutsy backport] Very poor font rendering due to unpatched in-source Cairo

Bug #189720 reported by Matthew Gregg
10
Affects Status Importance Assigned to Milestone
Mozilla Firefox
Invalid
Medium
xulrunner-1.9 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: firefox-3.0

Older Cairo in Gutsy might be causing Gutsy backports version(3.0~b3~cvs20080101t1000+nobinonly-0ubuntu1~gutsy1) to have badly rendered fonts.

For reference:
http://forums.mozillazine.org/viewtopic.php?t=619955&sid=9591065c0181cb8f4c846057f6f67c0e
https://bugzilla.mozilla.org/show_bug.cgi?id=375591

Revision history for this message
In , Dev+bmo (dev+bmo) wrote :

I can confirm it, on Ubuntu 7.10 (I did notice it on 7.04 too).

The actual settings Minefield uses seem rather random, but much more based on fontconfig than on my Gnome settings. For instance, on the fontconfig-config package configuration, if I set the font tuning method to None (which I believe should disable hinting), Minefield seems to start applying aggressive, full hinting to fonts.

Right now I managed to get it somewhere close to my settings (slight hinting, subpixel smoothing), but it doesn't look as good as other apps, and by looking closely I can see it doesn't use as many levels of intermediate colors as it should.

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a9pre) Gecko/2007102004 Minefield/3.0a9pre

Revision history for this message
In , Dev+bmo (dev+bmo) wrote :

Created attachment 287619
Comparison: GTK+ vs Firefox 2 vs Minefield

Comparison between GTK+ (made with a label on Glade), Firefox 2 and a recent Minefield build. See how Firefox 2 renders pretty much the same as GTK, if not absolutely equal (I haven't made an exact-pixel comparison).

I chose small-size and italic fonts because they illustrate better the effect. Courier New is particularly affected, since it is so thin that most of its vertical strokes become less than one pixel wide and show heavy color distortion.

Rendering libraries: Ubuntu 7.10, libxft2 2.1.12, libfreetype6 2.3.5, fontconfig 2.4.2.
Settings: slight hinting using native hinters, grayscale anti-aliasing on gnome-appearance-properties and forced subpixel anti-aliasing via fontconfig (this is the recommended hack to make OpenOffice.org render fonts decently, but even when I had Ubuntu's default settings I had similar problems).

Revision history for this message
In , Breezes (wangyuanzju) wrote :

I encountered the same problem in Ubuntu 7.10, as in this post.

http://forums.mozillazine.org/viewtopic.php?t=602280

Revision history for this message
In , Ted Mielczarek (ted-mielczarek) wrote :

CCing stuart.

Revision history for this message
In , Alejandro Zunino (azunino) wrote :

I have the same problem using firefox 3.0~alpha8-0 (included in Kubuntu 7.10 and Ubuntu 7.10 repos) and firefox-3.0b2pre.en-US.linux-i686.tar.bz2 (yesterday build). In firefox 2.0.0.8 the fonts look great. It seems that firefox 3 is beign too agressive hinting fonts because they look too thin compared to the rest of the applications.

I have tried all possible combinations of hinting/antialias using the KDE font preferences. In addition, I have tried echoing the preferences:

echo Xft.antialias: 1 | xrdb -merge

echo Xft.hintstyle: hintnone | xrdb -merge

echo Xft.hintstyle: hintslight | xrdb -merge

echo Xft.hintstyle: hintmedium | xrdb -merge

echo Xft.hintstyle: hintfull | xrdb -merge

The best combination is Xft.antialias: 1 and Xft.hintstyle: hintfull because with these options the fonts are antialiased, but look too thin. All the other options produce ugly fonts. BTW, I use subpixel hinting (Xft.rgba: rgb).

I can provide more information for hunting this bug.

Revision history for this message
In , Sylvain Pasche (sylvain-pasche) wrote :

Created attachment 289646
Hinting comparison with subpixel rendering and cairo 1.4/1.5

Apparently the difference is related to the cairo version. The attached screenshot was done on Ubuntu 7.10.
The Ubuntu version there is 1.4.10, while Firefox cairo version should be close to the snapshot version 1.5.2.
For none or slight hinting, the rendering is similar between cairo 1.4 and 1.5, but for medium and full the 1.5 cairo version is a bit more "aggressive", which explains why the fonts looks thinner.

You could upgrade your cairo version to 1.5 on your system if you want more consistency between Firefox 3 and the other applications.

On the screenshot, we can see that there is no difference between medium and full hinting on both cairo versions. My opinion is that it would be great to have the medium hinting with cairo 1.5 look like the full/medium one of cairo 1.4. This would make a more progressive transition between slight and full, for people who prefer an intermediate setting.

Revision history for this message
In , Sylvain Pasche (sylvain-pasche) wrote :

Created attachment 289662
gtk/Firefox 3 on Fedora 8

on top: native GTK app.
bottom: Firefox trunk

I just tested on Fedora 8, and the rendering between Firefox 3 and the native GTK apps is exactly the same. Maybe the rendering depends on the font used. Cairo, freetype and fontconfig are at the same version between Ubuntu 7.10 and Fedora 8 (1.4.10, 2.3.5 and 2.4.2 respectively).

Revision history for this message
In , Matthias (matthias-berndt) wrote :

I think this is a problem with the default settings in Firefox. For whatever reason, Firefox 3 uses a serif font instead of the sans-serif default from GTK.

Revision history for this message
In , Matthias (matthias-berndt) wrote :

Created attachment 289695
Firefox screenshot

Revision history for this message
In , Matthias (matthias-berndt) wrote :

Created attachment 289696
wireshark as an example for a regular GTK program (as opposed to firefox).

Revision history for this message
In , Dev+bmo (dev+bmo) wrote :

I should note I use slight hinting, and I'm having this problem. I also installed Ubuntu 7.10 on a brand new machine last week, and right on the first local system start, before any updates or config changes (other than enabling subpixel anti-aliasing and slight hinting via gnome-appearance-properties) were made, I installed Minefield, and experienced the same results as before.

Also, I can assure I experience it on every font I have tried so far. That includes several free fonts, Microsoft's core fonts, and even Office 2007's ClearType series.

Now for something weird: on my new computer at work (also running Ubuntu 7.10), *all* text rendering looks as bad as Minefield does at home, on every application, since the first day.

To quickly sum it up:
- Old home box: nVidia card, Ubuntu looked nice, Minefield looked horrible;
- New home box: same story;
- Old work box: ATI card, Ubuntu looked nice (in grayscale; its monitor as a CRT one), Minefield seemed perfect
- New work box: ATI card, Ubuntu looks like crap (both on grayscale and on subpixel), Minefield looks the same. At least one of my coworkers is having the same issue with font rendering on the whole system.
All of them use (or used) Ubuntu 7.10 with the distribution's standard proprietary video drivers. All hinting styles seem to be affected.

I can't really make any correlations here, it's almost like it is a random occurrence...

Revision history for this message
In , Sylvain Pasche (sylvain-pasche) wrote :

I did some investigations, and I found out why the font rendering is different between Minefield and the other GTK/Pango applications. Ubuntu is patching cairo to include support for lcd-filtering while the cairo version used in Minefield is not patched.

Hopefully, the lcd-filtering patch will be integrated upstream in the future (http://bugs.freedesktop.org/show_bug.cgi?id=10301)

Revision history for this message
In , Dev+bmo (dev+bmo) wrote :

Regarding comment #11, after some investigation, I found out the true problem on my new work computer is the monitor, so please disregard the comments about it.

Revision history for this message
In , Dev+bmo (dev+bmo) wrote :

I've compiled Minefield from trunk myself, using only Ubuntu-distributed libraries (like libcairo2-dev), but the text rendering remained the same. Is there anything obvious I'm missing?

Revision history for this message
In , Sylvain Pasche (sylvain-pasche) wrote :

(In reply to comment #14)
> I've compiled Minefield from trunk myself, using only Ubuntu-distributed
> libraries (like libcairo2-dev), but the text rendering remained the same. Is
> there anything obvious I'm missing?

Did you use the --enable-system-cairo in your .mozconfig? Note that you'll need cairo >= 1.5. That's only in Hardy for now.

Otherwise you can patch the in-tree cairo version using the patch on https://bugs.freedesktop.org/show_bug.cgi?id=10301

Revision history for this message
Matthew Gregg (mcg) wrote : Font's blury

Binary package hint: firefox-3.0

Older Cairo in Gutsty might be causing Gutsy backports version(3.0~b3~cvs20080101t1000+nobinonly-0ubuntu1~gutsy1) to have badly rendered fonts.

For reference:
http://forums.mozillazine.org/viewtopic.php?t=619955&sid=9591065c0181cb8f4c846057f6f67c0e
https://bugzilla.mozilla.org/show_bug.cgi?id=375591

Revision history for this message
Milan Bouchet-Valat (nalimilan) wrote :

This is really an issue since FF3's webpage and UI fonts are much worse than in FF2. In Gutsy, Cairo adopted tweaks for LCD screens (at least) that were really nice. In FF3 backport fonts look terrible. See the links above for an explanation of issues and solutions.

I can't tell whether this is the same in Hardy; if not, this is less of a problem, but in the other case it should really be fixed.

Changed in firefox-3.0:
status: New → Confirmed
description: updated
Revision history for this message
VF (vfiend) wrote : Re: [Gutsy backport] Very poor font rendering due to Cairo issues (ragression since FF2)

I also have this issue on Gutsy, it would be nice if someone using Hardy could verify whether this is not in fact a regression in Hardy's FF3.

Changed in firefox:
status: Unknown → New
Revision history for this message
Matthew Gregg (mcg) wrote :

Fonts appear sharp on Hardy. FF3 b3

Revision history for this message
Milan Bouchet-Valat (nalimilan) wrote :

Do you mean good by "sharp"? If yes, we can mark this bug as "Fix committed" and simply wait for Hardy to be released, I guess the Gutsy backport is simply a testing version, isn't it?

Revision history for this message
Matthew Gregg (mcg) wrote :

Appears to be correct with my eyes. I have not confirmed that FF3 is being built correctly, re: the cairo issues linked to the bug. I guess I don't understand how a backport bug relates to Hardy bug? I thought that a bug in a backport would be a separate issue from a bug in Hardy?

Revision history for this message
VF (vfiend) wrote :

I've noticed the issue with the backport and official mozilla upstream builds, so if it's working on Hardy it's likely been compiled differently somehow.. I'm not sure it's really important to fix the backport, just making sure it isn't this bad on Hardy.

Revision history for this message
Fabien Tassin (fta) wrote :

If you backport only firefox-3.0 and xulrunner-1.9 from hardy to gutsy, that's expected.

You also need to backport cairo (1.5.8) and fontconfig as they contain the sub-pixel LCD filter.
Without those two, xulrunner-1.9 will switch to internal cairo at build time, which is not patched and then ff3 will have no sharp font as you described.

Revision history for this message
Fabien Tassin (fta) wrote :

This is not a firefox-3.0 but a xulrunner-1.9 issue. See comment #7.
Well, it's not even an issue, it's more a backport decision to make.

Revision history for this message
In , Darren Salt (dsalt) wrote :

I find that
  $ echo Xft.rgba: none | xrdb -merge
is needed to cause proper display, as configured in xfce-mcs-manager and also in fontconfig-config. Something's not making use of the settings or is trying to second-guess them (LCD monitor, but I can tell when RGB alleged subpixel a-a is in use - colour fringes are visible).

(Debian testing/unstable; Minefield 3 beta 3 compiled from source. I've not yet tried cairo from experimental.)

Revision history for this message
In , Sylvain Pasche (sylvain-pasche) wrote :

The main issue this bug covers is related to the apparent color fringes. So I'll solve this as a duplicate of bug 404637 which has a better description.

Please file another bug if you still see font issues not related to color fringes on latest trunk (be sure to check for existing bugs first of course).

*** This bug has been marked as a duplicate of bug 404637 ***

Revision history for this message
In , 12345667890gregfdbdfsdbd (12345667890gregfdbdfsdbd-deactivatedaccount-deactivatedaccount) wrote :

Created attachment 311797
Firefox 2 and Firefox 3 fonts rendering comparision.

As you can see on the screenshot, Cairo 1.5 is rendering fonts incorrectly (my preferred settings are lcd subpixel rendering with slight hinting) and also is selecting wrong font - it should be a Helvetica, not Verdana-like one.

The problem does not exist on Windows machine. I've posted this on bugzilla.redhat.com: https://bugzilla.redhat.com/show_bug.cgi?id=244384

Revision history for this message
In , Sylvain Pasche (sylvain-pasche) wrote :

Could be fontconfig / pango related. I remember seeing similar issues with font selection, are you on KDE?

For the dpi, try setting it to -1 so that it matches your desktop setting. I'll try to have a look at the bugs you reported when bugzilla is in better shape.

Changed in firefox:
status: New → Invalid
Revision history for this message
Przemek K. (azrael) wrote :

Gutsy is EOL now.

Changed in xulrunner-1.9 (Ubuntu):
status: Confirmed → Invalid
Changed in firefox:
importance: Unknown → Medium
status: Invalid → Unknown
Changed in firefox:
status: Unknown → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.