understandable linux tips, tricks and tutorials

Warning

Font hinting until very recently has been a patented technology. The patents that lead to subpixel font hinting being turned of by default in the freetype2 library have now expired. It is now turned on by default going forward. Unfortunately openSUSE 11.4 ships with a version that does not have the bytecode intepreter turned on. This howto sets out how to get a version with it enabled.

This howto is for openSUSE 11.4. Click the link for a howto for font hinting on openSUSE 11.3

Install Muzlocker Repo

The first step is to install a new repo from the openSUSE build service. Do this by running the following commands:

sudo zypper addrepo http://download.opensuse.org/repositories/home:/muzlocker/openSUSE_11.4/ subpixel
sudo zypper ref
sudo zypper dup

This will add a new repository, refresh your package list and upgrade the freetype and associated packages to packages with font hinting.

Configuration

Then create a new file called .Xdefaults in your home directory, containing the following text:

Xft.autohint: 0 
Xft.lcdfilter: lcddefault 
Xft.hintstyle: hintslight 
Xft.hinting: 1 
Xft.antialias: 1 
Xft.dpi: 96 
Xft.rgba: rgb 

You can play with the third line by changing it to Xft.hintstyle: hintfull. I find that this works best on my machine. However, try both to see which looks better on your machine.

Then create another new file in your home directory called .fonts.conf, with the following text:

<fontconfig> 
<match target="font"> 
<edit mode="assign" name="rgba"> 
<const>rgb</const> 
</edit> 
</match> 
<match target="font"> 
<edit mode="assign" name="hinting"> 
<bool>true</bool> 
</edit> 
</match> 
<match target="font"> 
<edit mode="assign" name="hintstyle"> 
<const>hintslight</const> 
</edit> 
</match> 
<match target="font"> 
<edit mode="assign" name="antialias"> 
<bool>true</bool> 
</edit> 
</match> 
</fontconfig>

Make sure the line hintslight matches the third line of your .Xdefaults file (see above). Logout of your desktop and login again for the changes to take effect.

Configuring Your Desktop

Once you’ve logged back in to your Desktop, you will need to configure the font configuration settings for the desktop. See my page on font hinting in openSUSE 11.3 for the configuration dialogs for Gnome and KDE. For KDE, make sure that the “Use Anti-Aliasing” setting is set to “System Settings”. For Gnome, use the Appearance section of the control panel to configure the anti-aliasing settings to your liking. Please note that you may have to play a bit with the settings, for Gnome, however, usually the defaults work best.

All done – pretty fonts abound.

8 Comments
  1. I believe the patent expired already. Also in the newest freetype hinting should be enabled by default.

    • You are correct. The relevant patents have expired. This is a hangover from a previous article. I’ll change the warning accordingly. However, openSUSE ships with freetype2 version 1.3.1. Whereas the bytecode interpreter was turned on by default in versions >= 1.4. The repo referred to above installs version 1.4.4.

  2. Great tip, but unfortunatly the repo URL seems to be broken?

  3. Sorry but I’m confused.
    According to http://www.freetype.org/patents.html bytecode hinting patent(s) expired (and ) I thought it was enabled by default in OpenSuse 11.4) but subpixel hinting (colour filtering) should be still patented (and needs freetype patched to work in O.Suse), or I’m missing something?
    Regards

  4. Is the published FreeType patched to enable sub-pixel hinting (by applying patches from http://www.infinality.net/blog) or just enables sub-pixel rendering?

Leave a Reply

Site last updated October 20, 2012 @ 12:53 pm; This content last updated September 12, 2012 @ 3:16 am