Tuesday 21 June 2016

Tiling wm font rendering

Desktops like KDE or GNOME have their nice panels to set up themes and fonts but in a simple tiling window manager there are no such settings. From time to time I face problems with font rendering on xorg updates. Fonts just start looking ugly from one day to another.

Xorg's font configuration is handled by the extra/fontconfig package as a dependency of the xorg installation.

Configuration can be easily done by creating symlinks of predefined config files under /etc/fonts/conf.avail/ under the /etc/fonts/conf.d/ directory as per the Font Configuration Arch Wiki.

Fontconfig sets up default symlinks in /etc/fonts/conf.d/ which is a good start. But here the problem comes! If you change these symlinks to your liking a fontconfig upgrade can mess them up, hence you have to redo the configuration after such upgrades.

How to override this?

You can specify per-user defined symlinks under the .config/fontconfig/conf.d/ dir. But if there are conflicts then the global one takes precedence (why?!). To override this you do this:

# cd /etc/fonts/conf.d
# cp 50-user.conf 00-user.conf

Then set up your font config symlinks to your taste under your user config directory. I want to change the hinting setting from the globally defined "slight" one (which gives ugly look on my LCD) to "full". I do it with this symlink command:

$ ln -s /etc/fonts/conf.avail/10-hinting-full.conf .config/fontconfig/conf.d/