(Revision 3, 2013-02-19)
Infinality is a project that aims to improve font rendering on *nix operating systems. This is done via a patchset for the Freetype font engine, configuration through custom environment variables, and a complete set of Fontconfig files.
This article will guide you through installing and setting up Infinality on your Slackware machine.
Infinality ships with a set of styles e.g. linux, win7 etc. (more on that later), and depending on the style you’re going to choose, you may or may not need to install some fonts that don’t come with Slackware. For example, the default Sans font for win7 or infinality styles is Arial, and for osx it is Helvetica. For linux on the other hand, it’s DejaVu Sans, which is a free font and comes preinstalled.
Both Windows and OS X include rich font collections, but you don’t have the right to copy them from an installation media or an installed system (and it’s a known fact that nobody does that).
Another option is to get other quality and free fonts (e.g. Ubuntu Font Family, Droid etc.) and configure your Desktop Environment to use them instead. You can find a variety of such fonts, over at SlackBuilds.org, or Google’s Web Fonts.
II. Build & install.
List of packages:
1) freetype, 2) fontconfig-infinality, 3) libXft (Slackware 13.37), 4) qt.
A word on libXft and Slackware 13.37: I provide a SlackBuild for libXft-2.3.1 (the version that comes with Slackware 14.0). This upgrade will solve some issues with a small number of applications (emacs comes to mind), and contains zero patches (the Ubuntu LCD_FILTER-related patch was finally merged upstream). If you don’t use emacs, or another program that relies on libXft, you can skip this (I only install this on my system for testing purposes).
A word on Qt: We rebuild qt against the new freetype. If we don’t do this, there will be some color fringing in Qt-based applications. If you don’t use such applications, you can skip recompiling qt.
Note: I also provide “compat32″ packages for Slackware64 users that want to run 32-bit applications (e.g. Wine, Skype). To setup multilib, please consult Eric Hameleers’ how-to.
Exit X11. Then, as root, build and install your packages one-by-one (freetype, fontconfig-infinality, then the rest):
$ upgradepkg --install-new --reinstall /tmp/<package>.txz
Under /etc/fonts/conf.avail/ there is a set of files in XML format. These are fontconfig’s rulesets and are responsible for things like antialias, hinting, font aliases, font substitutions, to name a few.
/etc/fonts/conf.d/ contains links to some of those files. You can think of them as on/off switches; if there is a link, the corresponding ruleset is enabled.
All these files/links have a 2-digit prefix. As a rule of thumb, the lower the number, the higher the precedence (although the flexibility of fontconfig’s syntax can complicate things a bit).
fontconfig-infinality installs its own set of files under /etc/fonts/infinality/ that are accessed through /etc/fonts/conf.d/52-infinality.conf. In order to avoid Slackware’s files overriding Infinality’s, we could do as follows:
- Save a list of the files in /etc/fonts/conf.d/:
$ cd /etc/fonts/conf.d $ ls *.conf > $HOME/default-fontconfig.txt
- Remove links for system rendering defaults:
$ rm 10-*
- Remove links for alternate config files:
$ rm 50-user.conf 51-local.conf
- Other files:
$ rm 44-wqy-zenhei.conf (read note below) $ rm 60-liberation.conf
Instead of deleting 44-wqy-zenhei.conf, you could comment out the blocks with the <alias> tag. To do that, enclose them with <!– and –>.
You can pick a style from a list:
$ cd /etc/fonts/infinality $ ./infctl.sh setstyle
Or directly choose one:
$ ./infctl.sh setstyle linux
You can even create your own custom styles. For more info, have a look at /usr/doc/fontconfig-infinality-<version>/README.
V. Fresh log-in, final notes.
Log-out and re log-in, or just reboot, for the changes to take affect. /etc/profile.d/infinality-settings.sh will get sourced and Infinality’s environment variables will be set. You can confirm this with:
$ env | grep -i infinality
An .Xdefaults file in your home directory will cover some rare cases of applications that still use this. Create this file and put the following lines inside:
Xft.authint: 0 Xft.lcdfilter: lcddefault Xft.hintstyle: hintfull Xft.hinting: 1 Xft.antialias: 1 Xft.dpi: 96 Xft.rgba: rgb
If for any reason you want to revert to Slackware’s stock packages, exit your X session, become root and:
$ removepkg fontconfig-infinality $ slackpkg upgrade freetype libXft qt
If however Infinality works for you, you can prevent slakcpkg from upgrading these packages by adding this line to /etc/slackpkg/blacklist:
A huge “thank you” to Infinality’s developer for his amazing work. Much appreciated.