So, what is this blog about you ask? Good question. For many years I found blogs silly. Even the name "blog" is silly.
However in the recent years I have had more and more trouble keeping organized with my adventures through the FOSS community. Also I have
come to the realization that it is a disservice to the community to spend hours working around bugs or configuring a
software package and not spreading the learned info in some manner or another. My response to these issues is what you
now see before you. Enjoy!

I typically document my Debian stable upgrades. I just brought my main work laptop from Stretch to Buster (which is actually still in testing) without much of any incident except for some strange (yet slight) font issues. So slight I might add I thought I was loosing my mind. This blog will document my un-maddening process...

The Stretch to Buster upgrade went smoothly enough, and on my new faster internet, took all but 15 minutes to download and install the ~1GB worth of updated packages. Followed by a quick reboot and fixing a few artifacts that lingered (but not worth mentioning), all seemed to be back to normal. This was on a Saturday. The upgrade process went fast and I still had the rest of the afternoon free. I could have gone out, or taken care of my overgrown lawn... Instead I chose the typical programmer response and clocked into $work to put in some extra hours on my shinny new upgraded OS. So I SSH over to our remote dev box in my terminal (Konsole) and.... something seemed off.

My console fonts were... blurry or fine? Normal... or not normal? I couldn't really tell. Something was amiss. I hadn't slept much the night before, perhaps my eyes were cloudy and dry. I squinted harder and moved closer. That just made the fonts worse. Confused, I did the next sensible thing and went for coffee thinking it was all in my head. But on my return, something was truly amiss with the fonts. Having remembered font troubles from a distantWheezy to Jessie upgrade, I was not looking forward to troubleshooting.

The first sensible idea I had was to mess with the font anti-aliasing settings in KDE. Typically, for 'hinting' options, I'd been running 'full'. The other option of 'None', 'Slight', and 'Medium' did not improve anything. The next reasonable idea I had was that perhaps the default system font had been changed. Not knowing what the fonts were in Stretch (or even if they differed), I installed some popular ones that are supposed to look good in terminals like fonts-liberation2, fonts-hack, and xfonts-terminus. The only one that didn't seem to have any blurriness issues was 'Terminus', but I really didn't like the style of it. I figured perhaps I'm just getting old and this was all in my head. I left my console configured with 'Terminus' and went about my business. (having now spent 3+ hours on the matter)

A few days later, I checked the font section of the Debian wiki. I noticed the advice to run:

dpkg-reconfigure fontconfig fontconfig-config

I'd used that command before, but its been a few years. I figured I'd try it on a whim. I don't ever remember it being interactive, but I was then prompted with:

Please select the preferred method for tuning fonts for screen rendering.
Select 'Native' if you mostly use DejaVu (the default in Debian) or any of the Microsoft fonts.
Select 'Autohinter' if you mostly use other TrueType fonts. Select 'None' if you want blurry text.

'Native' or 'Autohinter'? What the heck? So choose 'Native' if I use 'DejaVu' (which is a TypeType font) or 'Autohinter' if I use another TrueType font. Well that makes no sense. Instead of playing with this, I spent the next hour reading up on TrueType fonts, bitmap fonts, sub pixel hinting, etc. I browsed through the freetype website a bit assuming that the underlying engine of all this font shenanigans was libfreetype. Nothing stuck out until I found a reference to a Debian bug 866685 (from the font wiki above). It involves someone actually complaining about fonts changing upon upgrading libfreetype6! I read through the linked article which did not clarify much but only gave me the desire to experiment.

So first up, a text dump in Konsole using the default 'DejaVu Sans Mono' Here followed by the same thing using the old libfreetype engine via 'FREETYPE_PROPERTIES="truetype:interpreter-version=35' Here Wow! what a difference! Not so much that the text is blurry as it is just dimmer using the 'new' engine.

From the linked freetype article, it was recommended to use the liberation style fonts. Here is a comparison using the default Here and with the old engine Here. Hmm, not much of a difference between the two. Regardless DejaVu on the old engine still looks way better IMO.

The above was all done with the fontconfig-config package using the 'Native' hinting method. That is what is recommended. Lets see what happens when switched to 'Autohinter'. First up is the default DejaVu Sans Mono running in Autohinter Here, by comparison, liberation on the Autohinter Here Wow again! I still think DejaVu on the old engine with native hinting is the winner here (note I change my mind after enabling sub pixel hinting later), but find it strange that liberation is improved when using Autohinter as well since it is a known font to have correct native hints.

Changing between the new engine and old engine while using the 'Autohinter' made no difference in the rendered output. Upon digging around and looking at the source code, it is indeed one or the other. The engines for native and autohinting are two separate beasts.

Next, I realized I can now use sub pixel hinting when in 'Autohinter'. I've tried it before, but it would always leave color artifacts no matter which RGB arrangement I tried (and didn't seem to have any other effect).

So, where does this leave us? In no point do I think I ever saw the "new" engine actually improve anything. With this in mind, and the fact that all docs say not to use "autohinting", I was ready to just force everything to use the old engine in libfreetype and be done with it. But since sub pixel hinting actually makes a difference in 'Autohinter' mode, lets first compare that against the old engine. Here is DejaVu with 'Autohinter' and sub pixel hinting and Here is the old engine with subpixel hinting. Hmm, hard to decide as I can find things wrong with both. How about instead of a bunch of white text on a black background we do something a little more realistic. Nothing to make you eyes bleed like Perl code Aye? Here is DejaVu with autohinter and subpixel hinting. Now Here is the old engine running with subpixel hinting followed by the old engine running without subpixel hinting Here (Note not much of a difference in these last two).

Its a tough decision, but I think I am going to go with 'Autohinter' with subpixel hinting. There is some goofiness in some of the characters, particularly bold ones, but overall, many of the characters (particularly the 's') seem to exbibit a smoothness not found when using the subpixel hinting in the other modes/engines.

So that settles it, autohinting with subpixel hints it is! Only took 12+ hours to find, can't beat that (or can you?).

My only lingering question is why does subpixel hinting only seem to make a difference in 'Autohinter' mode???

I get the feeling from digging on the freetype mailing list that even though everyone agrees that the old v35 engine looked better, the new v40 engine is done in a more "proper" way and is therefore "better". Case in point. Also pointed out that "v40 is not an improvement over v35; it's rather a different hinting engine implementation mainly to support subpixel rendering". At least that explains why my above tests with v35 had no effect when subpixel rendering was enabled.