Updated: June 10, 2021
Sometimes, I feel like Phil in Groundhog Day. I wake up, I log into this or that distro, and then I have to face the issue of suboptimal fonts all over again. Problems that should not have existed a decade ago, let alone not have been fixed, seem to crop up, now and then, with almost evolutionary stubbornness. My latest set of sadness: the font clarity in Rocky Linux 8, an otherwise fine system.
By and large, I was quite happy with this CentOS-reincarnated distro. It follows in the same vein as its spiritual ancestor, and I was able to spit and polish the ordinarily server system into a very decent home offering without too much trouble. But the one issue that dejected me properly: fonts. For some reason, the desktop stuff looked okay, but in Web browsers, the text was thin, washed out, and you could actually see the color outline of antialiasing. Not good. Anyway, let us fix, shall we.
Problem in more detail
So this is what happens. Launch Firefox (or other browsers, for instance), and voila:
There are two possible solutions available.
Option 1: Subpixel antialiasing + infinality tweak
For some reason, using Subpixel (for LCD screens) rather than Standard (grayscale) seems to work less well in Rocky. However, on its own, this isn't a complete solution. We can do a bit more. Much like the trick I used in my openSUSE 15.2 essential tweaks guide, you need to tell the system to use the infinality interpreter mode for the freetype font library. Why would a user ever, EVER need to bother with this, beats me. Licensing reasons? Anyway, here you have two possible sub-options:
- Declare the change in /etc/environment.
- Declare the change in a custom script under /etc/profile.d/. You can name this script something like freetype.sh.
In both cases, the content of the file should be:
export FREETYPE_PROPERTIES="truetype:interpreter-version=38 cff:no-stem-darkening=1 autofitter:warping=1"
The available settings for the TrueType interpreter are:
truetype:interpreter-version=35 # Classic mode (default in 2.6)
truetype:interpreter-version=38 # Infinality mode
truetype:interpreter-version=40 # Minimal mode (default in 2.7)
Option 2: Grayscale antialiasing + full hinting
Also, by default, Rocky Linux 8 uses grayscale and slight hinting. With full hinting, you will most likely see a change in how the desktop elements are rendered, but the display of text will be sharper or clearer. If you don't feel confident fiddling with configuration files, you can try this option (first). You STILL need to have Gnome Tweaks installed, though. Alas.
And that's what I've got in this tutorial. Ideal? Probably not. Helpful? I should hope so. At the end of the day, our interaction with machines includes a great deal of staring, with photons going back and forth between our eyes and whatever's shown on the screen. Typically, you can't take this trivial exercise for granted. In the vast majority of cases, the Linux fonts will not look as sharp as they should or can. Still.
I have to admit I don't know all the details that go into the packaging of font rendering libraries, or any of the associated legalese drama. As a user, what I see and care about is the end result, though. And when problems inevitably crop up, I have to work (unnecessarily) in a weird way, with lots of trial and error, trying to figure out the best way to make the displayed text look presentable. Frustrating and needless. Anyway, I shall soon publish a more complete tweaking guide for Rocky Linux, designed to help you transform the distro into a tight home-use machine. See you around.