Monday, March 06, 2017

How to Fix: Maddening Subpixel Font Rendering

This is mostly a note to my future self so that next time I set up a Linux machine, I don't have to re-invent this particular wheel.

Most computers nowadays, by default, display text using sub-pixel rendering.  Microsoft calls their implementation "ClearType", and I'm sure Apple has some similarly innocent-sounding name for it.  Without getting into the technical details, it's an optical illusion that, apparently, for most of the population, makes text nice and clear to read.  For me, it looks smeary, and makes my eyes continuously strain and toil to make everything all right.  They fail, and I get a mighty headache if I keep looking for too long.



Naturally, on my own computers I turn this noise the hell off.  But for a while now, there has been one niggling little hiccup where the first QT program I load (or maybe it's KDE specific, I really don't know.  All GTK and other programs are fine.) would fail to honor my very explicit settings and fall back on the default behaviour of stabbing me in the corneas.  The workaround was quick and easy, and generally if I'm at the computer I'm busy trying to do something, so I let the problem stagnate.

But in upgrading my laptop recently, I had one more little burst of attempting to figure this nonsense out, and figure it I finally did.

~/.Xresources:

Xft.autohint: 0
Xft.lcdfilter: lcdnone
Xft.hintstyle: hintnone
Xft.hinting: 0
Xft.antialias: 1
Xft.rgba: none

I don't even know which line(s) make the difference.  I just found a handful of Xft settings to try and lo, once these crunch through xrdb when the session starts, all is well.  These can go in a global Xresources file too of course.

I hope this helps somebody else, and I'm pretty sure it will at least help future me.

keywords for searching:
disable subpixel antialiasing
prevent sub-pixel anti-aliasing
qt kde first launch ignore freetype settings
why the crap do some programs use horrible blearytype font rendering
To others whose eyes are allergic to this crap but are also stuck on Windows, be warned: your Windows lies to you.  If you ask it to turn off ClearType, it will claim that it has done so and carry on smearing your text with eyeball-shredding colors.  You have to go through some crazy multi-step "Which of these looks better to you?" quiz to truly turn it off, and sometimes every one of the options presented will be using subpixel rendering.  So, as always, good luck Windows folks.

No comments: