Bug 6294 - cairo 1.0.4 broke subpixel rendering in GTK apps
Summary: cairo 1.0.4 broke subpixel rendering in GTK apps
Status: RESOLVED NOTOURBUG
Alias: None
Product: cairo
Classification: Unclassified
Component: freetype font backend (show other bugs)
Version: 1.0.3
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: Owen Taylor
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-17 06:09 UTC by Tomasz Torcz
Modified: 2006-05-14 10:31 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Tomasz Torcz 2006-03-17 06:09:34 UTC
After upgrading to cairo 1.0.4 (from 1.0.2) I noticed that fonts in GTK apps are
no longer subpixel rendered. Instead, plain gray antialiasing is used. Changing
font rendering parameters in GNOME's font capplet do not produce difference
between grey aliasing and subpixel rendering.
I recently upgraded Pango from 1.11.99 to 1.12.0, but I noticed improper
rendering after upgrading cairo.

What interesting, GNOME Terminal (or rather vte widget) DO react to capplet
changes and properly renders text with subpixel hinting. Other GTk widgets (like
menu bars, buttons etc.) render text all grey :(
Comment 1 Behdad Esfahbod 2006-03-17 08:09:53 UTC
Vte doesn't use Pango or Cairo, so it's expected that it doesn't change.

Neither Matthias Clasen can reproduce this, nor I.  And I reviewed all the
commits between 1.0.2 and 1.0.4.  The only interesting commits are two patches
from Frederic Crozat, one for supporting BGR subpixels, another to match our
hinting/subpixel code to the recommended usage by David Turner and that of Xft.
 Those two patches look very good and I doubt they break things.  Do you happen
to set to BGR instead of RGB by any chance?

The only possibility I see, reading the patch; if you compile cairo against an
ancient version of FreeType headers, it will disable subpixel.  What versions of
FreeType do you have around?  Did you happen to upgrade FreeType recently too?
Comment 2 Tomasz Torcz 2006-03-18 05:56:45 UTC
I'm using Slackware -current. The FreeType library is included in package for
Xorg-6.9. Documentation dir is called freetype-2.1.9.
freetype-config --version shows 9.7.3, and library is called libfreetype.so.6.3.7.
It haven't changed since middle of January, when the X11 package was upgraded.

Comment 3 Tomasz Torcz 2006-03-19 09:19:02 UTC
Now it got interesting.
1. I upgraded to "official" (from distribution) cairo-1.0.4, which appeared in
Slackware yesterday. Result: grayscale rendering.
2. I downgraded to cairo-1.0.2 which I had compiled and used earlier. Result:
color subpixel rendering.
3. I recompiled 1.0.2 and installed it. Result: gray rendering!!!

Any specific hints about which test in configure could fail and disable subpixel
rendering?
Comment 4 Behdad Esfahbod 2006-03-19 18:41:55 UTC
No, no configure test.

It's definitely something like the wrong FreeType or fontconfig headers being
used compiling cairo.
Comment 5 Tomasz Torcz 2006-03-19 21:28:30 UTC
Could you guide me to place in code which disables subpixel rendering? I'd like
to debug this issue, but now I don't know where to start.
Comment 6 Carl Worth 2006-03-19 21:35:55 UTC
(In reply to comment #5)
> Could you guide me to place in code which disables subpixel rendering? I'd like
> to debug this issue, but now I don't know where to start.

There's no specific code that disables subpixel rendering. Something is just not
working correctly.

As you've now discovered, the code in cairo 1.0.2 is capable of doing supixel
rendering when compiled and linked appropriately. So what you'll have to
discover now is what differences exist between how the working and non-working
versions are being compiled and linked. 
Comment 7 Behdad Esfahbod 2006-03-19 21:41:11 UTC
You may want to contact your distribution about the issue.
Comment 8 Tomasz Torcz 2006-03-22 08:17:23 UTC
After consulting with distribution, error is probably caused by Xorg 6.9.0, as
cairo compiled with Xorg 6.8.2 works fine.

As I want to get rid of this bug, I ask you again: what could be wrong? You
twice stated "something". If there are circumstainces when cairo disables
subpixel rendering, there must be some "if ()" statemnt in code which disables
it. Or maybe some "#ifdef" or similar measure. Please, tell me where I should
start looking. Where Cairo checks if headers are "ancient"? Any hints?
Comment 9 Behdad Esfahbod 2006-03-22 08:33:06 UTC
If you really are down to getting into the code, a simple grep would show where
it is.  It's in src/cairo-ft*.  Look for RGB...  There are a few ifdef's around
there.
Comment 10 Philip Langdale 2006-03-24 14:34:43 UTC
The actual problem is fontconfig, not freetype.

Fontconfig 2.3.x is required for subpixel rendering to work. The Xorg page
rather boldly states that 2.2.3 is the recommended release (and this is what is
included in the slackware 6.9 packages).

I built 2.3.2 here and then rebuilt cairo and things are back to normal. I did
not need to rebuild freetype (although I tried and noticed that 2.1.10 looked
worse than 2.1.9).
Comment 11 Tomasz Torcz 2006-04-04 06:38:47 UTC
After long analysis of those files and previous Xorg releases, I've failed to
discover why 1.0.2 worked for me. 
But problem got solved in meantime. Philip, could you ping Patrick (volkerdi@)
and ask him to ship newer fontconfig?
Comment 12 Tomasz Torcz 2006-05-14 02:05:34 UTC
Another data point: color subpixel redenering works in Firefox Web Browser
1.5.0.3 from Slackware package. But it still broken in other GTK apps.
Comment 13 Behdad Esfahbod 2006-05-14 04:41:18 UTC
This is a distro problem.  And no, Firefox isn't really a Gtk+ app, and doesn't
use cairo yet.
Comment 14 Tomasz Torcz 2006-05-15 03:31:54 UTC
Then Firefox make a good work with URL entry, search entry, menu bar and tabs
all looking like GTK.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.