Infinality on Slackware

The packages and SlackBuilds are for Slackware 13.37/14.0. I won’t be providing new ones for future Slackware/Infinality releases.


Revision 1, 2013-02-19: Fixed typos: ./infctl > ./infctl.sh

Revision 2, 2013-07-15: Added instruction about USE_STYLE in part IV.
Revision 3, 2013-09-24: Added configuration removal in part V.

Plain text version

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.

I. Fonts.

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.

Download the SlackBuilds or precompiled packages (Slackware 13.37 / 14.0) from my Dropbox account.

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

III. Fontconfig.

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 –>.

Interesting reads:
Fontconfig user documentation
Fontconfig configuration (Arch Wiki)
Fontconfig packaging tips (Fedora Wiki)

IV. Styles.

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.

Then adjust the USE_STYLE environment variable in /etc/profile.d/infinality.sh accordingly. The line reads:

USE_STYLE="DEFAULT"

Above that line, you’ll find a list with the available styles.

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 you want the configuration files removed as well:

$ rm -rf /etc/fonts/infinality
$ rm /etc/profile.d/infinality-settings.sh

If however Infinality works for you, you can prevent slakcpkg from upgrading these packages by adding this line to /etc/slackpkg/blacklist:

[0-9]+smsl

A huge “thank you” to Infinality’s developer for his amazing work. Much appreciated.