Subpixel Hinting for 11.2- GTK Apps- Solution

I wanted to share this with the larger community. I was able to get perfect subpixel rendering on my 11.2 install for GTK apps in KDE (I’ve tested this on GNOME as well- it works fine).

Steps to enable subpixel rendering:-

  1. Install the freetype2 packages from Index of /subpixel

  2. I have a patched cairo located in my OBS repo at Index of /repositories/home:/anshuljain/openSUSE_11.2/i586. Install the cairo package. This patched version differs from the earlier patched versions in Index of /subpixel. I have enabled the original LCD patch, which looks a LOT better than the previous cairo patched builds in the Supixel - openSUSE-Community repo.

  3. Create a file 10-lcd-filter.conf in /etc/fonts/conf.avail as, and copy the following contents :-

<?xml version=“1.0”?>
<!DOCTYPE fontconfig SYSTEM “fonts.dtd”>
<fontconfig>
<!-- Enable freetype’s new subpixel filter. Currently, only a cairo
version containing the patches from freedesktop #10301 respects this
setting. →
<match target=“font”>
<edit mode=“assign” name=“lcdfilter”>
<const>lcddefault</const>
</edit>
</match>
</fontconfig>

  1. Create a file ~/.Xresources in your /home directory and paste the following contents:-

Xft.lcdfilter: lcddefault

  1. Log out and login again.

Now for the necessary screenshots :slight_smile:
http://www.imageping.com/out.php/t58021_OpensuseSubpixel.png](http://www.imageping.com/out.php/i58021_OpensuseSubpixel.png)

Anshul

Thanks a lot. Perfect.

Thanks, this should be made the default. :slight_smile:

Thanks for the feedback guys :slight_smile: I’ll be creating a new set of RPMs- freetype and cairo both, with a cleartype patch (its already done, waiting for upload). This will probably eliminate the need for a config file modification as in my earlier method. IMO, these set of patches make the font rendering better :slight_smile:

Great! Could you possibly also add the *-32bit packages for those of us using x86_64?

  • Valur

Great job !!! Thanx :slight_smile:

Now hinting working fine. Thank you.

Ok I’ve just upgraded to 11.2 and Firefox fonts are terrible (see pic below), but I cannot get this to work.

I’ve followed the steps above, and things look ok in Konq, but I prefer to use FF for general web browsing.

On the left is Firefox 3.5.6 (for Suse 11.2) on the right is Konq 4.3.1.

http://www.enuffsaid.co.nz/nosubpixelhinting.png

I know the differences are subtle, and only visible on LCD displays, but after looking at this for a while the font smoothing/sub-pixel hinting version is much easier on the eyes.

Cairo and Freetype installed as above. Any ideas?

Thanks

Are you running 64-bit or 32-bit OpenSuse? I only ask, since if you are running 64-bit then I don’t think that repo has the *-32bit files needed to run 32 bit applications, in case your Firefox is a 32 bit application, while Konqi is 64 bit.

I’m pretty sure 32bit. Is there a way to tell from this (sysinfo)?


  OS:  Linux 2.6.31.5-0.1-pae i686
  System:  openSUSE 11.2 (i586)
  KDE:  4.3.1 (KDE 4.3.1) "release 6"

thanks

I had this same problem with subpixel hinting, Firefox/Thunderbird look bad, but nautilus looks good.
I tried the above mentioned procedure (updating cairo, adding 10-lcd-filter.conf and .Xresources file) but it did not work.

But I found a solution to this problem on mandriva forum (Text Antialiasing in Firefox? | Mandriva Forum) , add the below content to the fonts.conf file in your home directory
*<?xml version=‘1.0’?>
<!DOCTYPE fontconfig SYSTEM ‘fonts.dtd’>
<fontconfig>
<match target=“font” >
<edit mode=“assign” name=“rgba” >
<const>none</const>
</edit>
</match>
<match target=“font” >
<edit mode=“assign” name=“hinting” >
<bool>false</bool>
</edit>
</match>
<match target=“font” >
<edit mode=“assign” name=“hintstyle” >
<const>hintnone</const>
</edit>
</match>
<match target=“font” >
<edit mode=“assign” name=“antialias” >
<bool>true</bool>
</edit>
</match>
</fontconfig>
*

I’m using OpenSuse 11.2 on 64 bit machine.

My apologies to all those who posted and asked for help…I’ve been kind of on the outs so couldn’t respond earlier.

I’m not very familiar with 64-bit systems, so I dont know much :frowning: Maybe someone can help me, and I can port it to my repo in the OBS. I use a 32-bit system so all of the packages work for me.

I’ve created an alternate set of packages with Ubuntu patches for fontconfig, freetype and cairo…and they provide better font rendering experience as compared to the original patches. The repo is at Index of /repositories/home:/anshuljain:/ubuntu_patch/openSUSE_11.2.

Add the repo through the command zypper ar http://download.opensuse.org/repositories/home:/anshuljain:/ubuntu_patch/openSUSE_11.2/home:anshuljain:ubuntu_patch.repo. Ensure that the priority is set higher than the other repos (set it at 19). Then install the fontconfig, cairo and freetype packages from Yast by selecting the right repo version.

Feel free to explore the RPMS and comment :slight_smile:

@anshuljain

I’m pretty much interested in your Ubuntu patched versions of fontconfig, freetype2 and cairo in order to get rid of the horrible (sorry, but let’s face it) fonts in openSUSE 11.2.

I have some questions:

  1. Are these steps …
  1. Create a file 10-lcd-filter.conf in /etc/fonts/conf.avail as, and copy the following contents :-

<?xml version=“1.0”?>
<!DOCTYPE fontconfig SYSTEM “fonts.dtd”>
<fontconfig>
<!-- Enable freetype’s new subpixel filter. Currently, only a cairo
version containing the patches from freedesktop #10301 respects this
setting. –>
<match target=“font”>
<edit mode=“assign” name=“lcdfilter”>
<const>lcddefault</const>
</edit>
</match>
</fontconfig>

  1. Create a file ~/.Xresources in your /home directory and paste the following contents:-

Xft.lcdfilter: lcddefault

… still required with the Ubuntu patched versions?

  1. I read Subpixel Font Rendering in Linux « bekir ÅŸerifoÄŸlu | blog and I’m wondering if there’s a need for a patched libxft as well besides the packages you already provide at your OBS repo.

  2. Would you mind writing a structured step-by-step howto (for the wiki or the OSF howto section) in order to document this properly for the openSUSE community? Not sure what the general opinion is, but IMO the fonts really look horrible by default and this is a much appreciated contribution. Just my 0.02$

Best and thanks in advance,
R

Also, as of the repo: …/openSUSE_11.2 obviously is for oS 11.2. And …/KDE_Factory_Desktop? For KKFD with oS 11.2? Or for 11.3 dev=factory? Or 11.3 dev=factory with KKFD? Just curious.

Best,
R

Yep, the stock fonts on Opensuse systems are pretty sub-par. To be honest, they’re terrible as compared to Ubuntu/Debian’s. Thats why I went about creating these patches directly from Ubuntu’s sources :slight_smile:

I don’t think you’d need the 10-lcd-filter.conf file in /etc/fonts as this is provided (now) by the fontconfig rpm in the ubuntu_patch repo. No harm in letting it reside where it is. However, the .Xresources file is still required. The .Xresources file sets the Xft filter on per-user basis and not universally. To set it universally, add the line “Xft.lcdfilter: lcddefault” and “Xft.hintstyle: hintslight” (without the quotes) in the /etc/X11/Xresources file, right at the end.

I’m trying to come up with some way to automagically updating the /etc/X11/Xresources through the fontconfig rpm, so everything will be set automatically. I had a quick look at the libxft stuff and yes, I had forgotten to patch Opensuse’s xft in the xorg-x11-libs rpm. The good news is that our Opensuse devs had indeed patch libxft with another set of lcd-filter patches. The Ubuntu patches are over and above these set of patches. I managed to perform a quick and dirty patch of this rpm and it is available in my OBS repo. Do give it a shot and let me know how it works for you. Its working fine for me here. I’ll clean up the spec file later :slight_smile:

The KKFD repo is compiled against KDE 4.4, and as you’ve pointed out the openSUSE_11.2 repo is compiled against KDE 4.3.x. I did have a problem with GTK+ apps under KDE 4.4 Beta2 and recompiled cairo to get subpixel hinting back. Thus the need for this repo.

I did want to add a step-by-step guide for using my repo to get subpixel hinting, but don’t know where and how to start. Morever, I’m not too sure if adding tips on subpixel hinting is allowed in the official Opensuse wiki. I’d be glad to add it, if I can.

Anshul

Sorry, but I am lost. From the original post, you suggest that we have to install cairo, only. Is that true? Do we need to install fontconfig-2.8.0-14.1.i586.rpm, freetype2-2.3.9-16.1.i586.rpm, etc?

The original post was written before I started to apply the Ubuntu patches in the ubuntu_patch repo. Now, just to be clear- there are 3 different “sets” of patches in existence. One is a Cleartype patch, next is the LCD Filter patch and the other is the Ubuntu Patch. The patch thats present in the original repo is the LCD Filter patch.

What is present in the ubuntu_patch repo are entirely new set of RPMs which have been patched with the original Ubuntu patches directly taken from their website. Now, you can go with the steps in the original post and merely replace the cairo rpm…or you may replace the freetype and fontconfig rpms as well. Theres no difference between the freetype in the Index of /repositories/home:/anshuljain and Index of /subpixel repo. I added the fontconfig rpm to reduce the additional step of manually creating the 10-lcd-filter.conf file in /etc/fonts/conf.* and the fontconfig is a newer one that the stock Opensuse 11.2 one which comes with 2.7.0. I have version 2.8.0 in the repo.

The Ubuntu patched rpms are the ones that I’d recommend…and they’re far superior compared to the original LCD filter rpms. These are present in the Index of /repositories/home:/anshuljain:/ubuntu_patch repo.

I hope I was clear :slight_smile: If not, then please do let me know.

Thank you for this, anshuljain. My fonts never looked better :slight_smile:

I don’t think you’d need the 10-lcd-filter.conf file in /etc/fonts as this is provided (now) by the fontconfig rpm in the ubuntu_patch repo. No harm in letting it reside where it is. However, the .Xresources file is still required. The .Xresources file sets the Xft filter on per-user basis and not universally. To set it universally, add the line “Xft.lcdfilter: lcddefault” and “Xft.hintstyle: hintslight” (without the quotes) in the /etc/X11/Xresources file, right at the end.

For the time being, I applied both the 10-lcd-filter.conf and the changes to /etc/X11/Xresources and I grabbed the rpms from your KKFD repo now as I’m running oS 11.2 with KDE 4.4 RC3. For my result see:

  1. clean desktop ImageShack - Best place for all of your image hosting and image sharing needs
  2. dirty (FF 3.5.7) ImageShack - Best place for all of your image hosting and image sharing needs

I’m trying to come up with some way to automagically updating the /etc/X11/Xresources through the fontconfig rpm, so everything will be set automatically. I had a quick look at the libxft stuff and yes, I had forgotten to patch Opensuse’s xft in the xorg-x11-libs rpm. The good news is that our Opensuse devs had indeed patch libxft with another set of lcd-filter patches. The Ubuntu patches are over and above these set of patches. I managed to perform a quick and dirty patch of this rpm and it is available in my OBS repo. Do give it a shot and let me know how it works for you. Its working fine for me here. I’ll clean up the spec file later

Works for me, thanks!

I did want to add a step-by-step guide for using my repo to get subpixel hinting, but don’t know where and how to start. Morever, I’m not too sure if adding tips on subpixel hinting is allowed in the official Opensuse wiki. I’d be glad to add it, if I can.

You’re right! Think about providing the instruction at opensuse-community.org (maybe asking yaloki) or at the forums howto section.

Honestly anshuljain, this is a great job!!! While I still think that my Ubuntu 9.10 GNOME desktop looks prettier (not sure why, maybe this has to do with GNOME VS KDE4), the Ubuntu patches provided at your repo definitely beat the pants off comparing to the default.

Respectfully,
R

I cant get this work in openSUSE 11.2 (x86_64) k KDE 4.4.3 :frowning: