Bitmap Fonts on Linux

Chances are, if you use a rolling release Linux distribution (such as Arch Linux or one of its derivatives, or openSUSE Tumbleweed) in combination with bitmap fonts (probably more proeminent with tiling window manager users, at some point during the past few weeks you’ve been either:

  1. Seeing squares instead of characters in your title bars

    Good thing we have icons

    Pango 1.44.1

    Good thing we have icons

  2. Seeing a default font in your title bars

    Here they apparently added a fallback to a default font instead of just showing glyphs

    Pango 1.44.3

    Here they apparently added a fallback to a default font instead of just showing glyphs

Instead of:

  • Seeing your default font

    Pango 1.43

After some digging into how awesomewm handles fonts, I stumbled upon mentions of Pango.

Using this program to print out all the available typefaces, lo and behold, my font(s) were nowhere to be seen

[~/tmp/pango]$ ./pango-list-typefaces | grep Terminus
[~/tmp/pango]$ ./pango-list-typefaces | grep Tamsyn
[~/tmp/pango]$ echo ":("
:(

After more investigation, I found out that Pango 1.44 removed support for bitmap fonts. And guess what, both Terminus (which I use as the default rofi font) and Tamsyn (awesomewm) are bitmap fonts.

To get my fonts back I relied on the package manager cache to revert to a previous working version of Pango (1.43):

[~/tmp/pango]$ pacman -U /var/cache/pacman/pkg/pango-1:1.43.0-2-x86_64.pkg.tar.xz

To ensure the package doesn’t get updated by accident (i.e. when running pacman -Syu), we can use pacman.conf's IgnorePkg parameter:

[options]
# ...
# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
IgnorePkg   = pango

Subsequent upgrades will warn that the package will not be updated:

$ pacman -Syu
...
:: Starting full system upgrade...
warning: pango: ignoring package upgrade (1:1.43.0-2 => 1:1.44.3-1)
 there is nothing to do

One of the Pango developers made some interesting points regarding the future of the project, especially:

Freetypes FT_Face object has locking semantics that are broken and hard to work with; they are constantly getting in the way as we are juggling hb_fonts, FT_Face and cairo scaled font objects.

Using Harfbuzz for font loading means that we will lose support for bitmap and type1 fonts. We think this is an acceptable trade-off, but others might disagree. Note that Harfbuzz does support loading bitmap-only OpenType fonts.

Meaning bitmap-only OpenType fonts are still supported through Harfbuzz, which is the shaping engine Pango uses (I know, Linux text rendering…).

Arch Linux (and maybe other distros) provides an OTB version of the Terminus font under community/terminus-font-otb which should work with the latest versions of Pango.

Another solution would be to export BDF/PCF fonts to OpenType/TTF through FontForge.

All in all, these are just some of the things you sign up for when using a rolling release Linux distribution.

UPDATE 23/09/19: looks like keeping Pango back breaks Thunar. I need to sort out my bitmap font problem :).

UPDATE 26/11/19: an OTB version of tamsyn-font just showed up on the AUR: tamsyn-font-otb. I can finally upgrade pango!


linux

472 Words

2019-08-26 13:03 +0300