Haunted by Hermann Zapf

Linux gives me, for worse or better, the ability to coerce nearly every application into picking any font. The respective component in its font stack is the aptly named Fontconfig software. This is good because some applications insist on fonts I don’t like and bad because sometimes my configuration does the wrong thing, resulting in bizarre text rendering problems.

One of those has plagued me for months. When using i3lock, the unlock indicator used a swirly, cursive font from the TeX Gyre project instead of my default sans-serif font. I’ve eventually identified it as TeX Gyre Chorus which appears to be a libre variant of ITC Zapf Chancery. Why would i3lock ever get the idea to use that of all the fonts? It didn’t make much sense, the mere act of making TeX fonts available to the rest of the system shouldn’t do something this drastic…

Eventually I’ve had the idea to use the FC_DEBUG environment variable with 4096 as value, this revealed that the query was empty or in other words, no font was set at all. For some inexplicable reason, fc-match "" returns something entirely different.

Thanks to Cairo and its simple API, it didn’t take me long to figure out a fix. While it recommends to use Fontconfig directly for serious usage, I’d rather not. Just see for yourself at FcPatternBuild and recoil in horror.