qt4 apps don't support subpixel rendering

Bug #217729 reported by Bruno Henriques
22
Affects Status Importance Assigned to Milestone
Debian
Fix Released
Unknown
qt4-x11 (Ubuntu)
Fix Released
Wishlist
Unassigned

Bug Description

Binary package hint: libqt4-core

Hi,

I'm using the Candara font from Vista as my main font in KDE3 and GTK2 apps and want to use it also in QT4 apps. I use medium hinting for KDE3 apps (slight is too blurry) and slight hinting for GTK2 apps (medium = full hinting on GTK2 apps, crappy on a lot of fonts), it's doable because GTK2 looks at local ~/.fonts.conf, while KDE3 and QT4 looks at global font configuration /etc/fonts/local.conf .

Problem with QT4 apps (KDE4 or not, the Last.FM client, Musicbrainz Picard, and qt4config have the same problem) occurs when using subpixel rendering. If deactivated, it seems to respect your hinting settings, if activated, it defaults to "pitbull" full hinting (I call it "pitbull" because it chews on fonts way too much :P ).

To recreate the bug set medium or slight hinting at /etc/fonts/local.conf with any form of subpixel rendering.

Revision history for this message
Bruno Henriques (bruno-m-henriques) wrote :
Revision history for this message
Bruno Henriques (bruno-m-henriques) wrote :
Revision history for this message
Bruno Henriques (bruno-m-henriques) wrote :
Revision history for this message
Tobias Wolf (towolf) wrote :

I can confirm this. At least it doesn't repect my xrdb hinting settings in .Xdefaults:

Xft.dpi: 133
Xft.hintstyle: hintslight
Xft.autohinting: 1
Xft.antialias: 1
Xft.rgba: rgb

Revision history for this message
Tobias Wolf (towolf) wrote :
Revision history for this message
B. Lin (bellylin) wrote :

Hi, I've come up with some patches that should improve the situation. But I'm not sure about how to submit them to the upstream..

01.basic.diff: respect hintstyle specified in fontconfig configuration (eg, .fonts.conf)
40.ftlcdfil.diff: use freetype lcd filter to do subpixel filtering
60.lcd-fontconfig-support.diff( this one not fully tested ): support fontconfig lcdfilter setting

( patch numbering indicates the order of patching)

Can somebody take a look at this?

Revision history for this message
B. Lin (bellylin) wrote :

40.ftlcdfil.diff.
(note that this one and the following are optional)

Revision history for this message
B. Lin (bellylin) wrote :

60.lcd-fontconfig-support.diff

Revision history for this message
Fathi Boudra (fboudra) wrote :

You can submit them to qt-bugs at trolltech dot com

Revision history for this message
Alexei M. (alexeim) wrote :

I have rebuild qt4-x11 from Jaunty sources (giving many *_4.4.3-1ubuntu3_i386.debs)
with these 3 patches.

I can confirm that the combination subpixel+hintslight works as expected:
subpixel antialiasing in horizontal direction and hinting in vertical direction.

If you tell me where to put a custom repo on 300M I could upload them for
you to have a look.

Revision history for this message
The Fiddler (stapostol) wrote :

Isn't it possible to upload files in Launchpad itself?

I'm very interested in this, do the packages compile cleanly?

Revision history for this message
Jonathan Thomas (echidnaman) wrote :

You could always set up a PPA to host your packages: https://help.launchpad.net/PPAQuickStart

Revision history for this message
Alexei M. (alexeim) wrote :

Here is my first attempt to build launchpad package archive
from the same sources as I used for local builds:

https://launchpad.net/~alexeim/+archive

One build is (unintentionally) for Jaunty another for Intrepid.

Revision history for this message
The Fiddler (stapostol) wrote :

I have installed this debs on Intrepid amd64, but I still can't seem to get hintslight rendering.

Attached is my /etc/fonts/local.conf. Is there anything else I need to do?

Revision history for this message
Moony (junk1112) wrote :

B. Lin... thank you VERY much for the patches. This was seriously a show-stopper for me with KDE4, because I am really particular about fonts.

Fiddler... I had trouble getting things to work as well.... it was still showing grayscale for me, and the font sizes were goofy looking. I'm running Fedora 10, so not sure how much of this applies to Ubuntu, but make sure the following are true:

1) You have a freetype build installed that has subpixel rendering enabled. Ubuntu probably does this by default. (Fedora doesn't)
2) You don't have a /home/yourname/.fonts.conf that is overriding the local.conf file
3) Run: xrdb -query | grep -i xft

The following values should look like this:

Xft.antialias: 1
Xft.hintstyle: hintslight
Xft.lcdfilter: lcddefault
Xft.rgba: rgb

If they don't, create or modify the file /home/yourname/.Xresources and put that stuff in there. Then, run: xrdb -merge /home/yourname/.Xresources

Then, restart KDE.

I believe that qt4 reads these values, but I could be wrong. It can't hurt to try though.

Revision history for this message
The Fiddler (stapostol) wrote :

Thanks for the pointers, Moony. I'm rather particular about my fonts, too, and this issue is the reason why I am not using KDE.

1) That's covered.

2) No, just the local.conf I attached to my previous post.

3) xrdb -query | grep -i xft
Xft.antialias: 1
Xft.dpi: 96
Xft.hinting: 1
Xft.hintstyle: hintslight
Xft.rgba: rgb

It doesn't specify an lcdfilter, but adding that doesn't seem to fix the issue.

Does anyone know where QT is getting its settings from? QT3 seems to use the specified settings, but QT4 seems stuck to full hinting, even with the new packages.

Revision history for this message
Moony (junk1112) wrote :

Grabbing at coattails here, but possibly make sure that libXft is up to date. Can't hurt anyway. I know it recently added hooks for freetype's LCD filtering.

Do you have screenshots of before and after, or at least one of those?

Revision history for this message
Moony (junk1112) wrote :

The other thing to try is to make sure that it is ACTUALLY using the updated qt packages... like, do this:

ls -al /usr/lib64/libQt*

or this if you run 32-bit:

ls -al /usr/lib/libQt*

..and make sure the dates match when the newer package was created. Once again... grabbing at coattails here.

Revision history for this message
B. Lin (bellylin) wrote :

Just FYI
Qt4 doesn't use libXft to draw fonts.
Also, Qt4 mainly read fontconfig settings. Xresource is only fallback option.

There are also patched rpm packages built for openSUSE
http://download.opensuse.org/repositories/home:/swyear/openSUSE_11.0/

Daniel T Chen (crimsun)
Changed in qt4-x11:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Jonathan Thomas (echidnaman) wrote :

A fix has been committed upstream for Qt 4.5.0.
The fix will be released to Ubuntu once Qt 4.5.0 is released and packaged.

Changed in qt4-x11:
status: Confirmed → Fix Committed
Revision history for this message
Sebastian Krause (sebastian.krause) wrote :

As Jonathan said, it will be fixed on Qt 4.5. Here is more information on the issue:

http://labs.trolltech.com/blogs/2008/09/01/subpixel-antialiasing-on-x11/

Debian has also had this bug for a very long time:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=448555

Revision history for this message
Jonathan Thomas (echidnaman) wrote :

QT 4.5 rc1 has been released to Kubuntu 9.04.

Changed in qt4-x11:
status: Fix Committed → Fix Released
Changed in debian:
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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