Monospace fonts and freetype emboldening: a follow-up

Last week I wrote about some font stuff, mentioning along the way that it was prompted by an issue in freetype. If a font has no native bold version, Freetype can produce one algorithmically when an app asks for bold text. This mechanism makes the glyphs wider. This is a bit of a problem for monospace (fixed-width) fonts, because the whole point is that their character widths should always be consistent, so blocks of characters will align correctly.

I did actually try and figure out how to make freetype do this - which it calls 'emboldening' - without widening glyphs, but wasn't able to figure it out, so instead I suggested a change to fontconfig which simply disables the emboldening entirely for fixed-width fonts. I sent this upstream. In response, someone very kindly stepped up and figured out how to do it properly: that someone is Raimund Steger, and here's his blog post on the topic.

So if you've been annoyed by this issue, you can build freetype with the patch from his post, and - joy of joys - you'll still get bold characters in Droid Sans Mono or Inconsolata, but they'll no longer be wider than regular ones!

I then worked out that the infamous Infinality had actually come up with something functionally identical in his patch set four years ago, but then changed it to simply disable widening for all fonts, as he apparently prefers it that way. That's obviously a much more 'subjective' change than disabling it for fixed-width fonts only, and it seems like no-one ever quite joined the dots and suggested the more objective improvement upstream. Details on that here, if you're interested.

I suggested to Raimund that he submit the change to freetype, so here's hoping it'll get picked up by upstream and save anyone else from encountering this in future!

EDIT: A further follow-up: Raimund submitted his patch to freetype, but it was rejected by Werner Lemberg on the grounds that it is actually most appropriately fixed 'one level higher than FreeType', i.e. in the platform/toolkit layer, i.e. in Cairo and Qt (to cover the major cases). So I've filed a Cairo bug. I tested KDE's behaviour, and it seems...interesting: I've filed a bug there as well.

Comments

Matěj Cepl wrote on 2015-02-15 08:00:
So, with my old (and dusty) bugmaster’s hat on, I have to ask: where is the bug? I don't see anything on https://savannah.nongnu.org/bugs/?group=freetype, http://news.gmane.org/gmane.comp.fonts.freetype.devel, or even on http://news.gmane.org/gmane.comp.fonts.freetype.user