Linux Fonts
- Bitmap Terminal Fonts
- Font Browsing - GUI Programs
- Font Browsing - Console Programs
- Font Browsing - xterm
- Caches
- Resources
Bitmap Terminal Fonts
I recently installed a new laptop and the Terminus font wasn't working on it in the terminal. After a bunch of research, turns out that Gnome people removed support for what they call "traditional BDF/PCF bitmap fonts" in Pango (see 1, 2, 3, 4, 5) in 2019. This in my understanding makes these "traditional" bitmap fonts unusable with any software that uses GTK today. I use gtkterm2 as my terminal, which uses GTK, so, Terminus doesn't work.
Interestingly enough, my other laptop does have a working Terminus font...
turns out, Debian has two Terminus font packages:
xfonts-terminus and fonts-terminus-otb. The latter is the former
converted to "OpenType Bitmap" format, which Pango (and consequently GTK
applications) can load. For any fonts which haven't been converted to
OpenType Bitmap format, you are on your own (i.e. until you convert them,
they won't render properly, will not show up in the selector, or will be
ignored).
The pango issue has a massive discussion on how to convert fonts which ought to be helpful if you end up attempting it. This might also be helpful.
A number of posters comment that after the conversion the text isn't rendered properly. My understanding is that at least some of these issues are/were due to (some of them long-standing) bugs in various software, both applications and toolkits. Given a lack of documentation in software in general, and a topic as complex as font rendering, this isn't surprising.
The following comment I think summarizes the situation well:
I agree with sentiments above that such breaking changes are best done as new major versions, which can be installed side-by-side with old versions to avoid breakage and allow application developers to consider the trade-offs when picking a library major version to use. Generally the discussion above is very disappointing due to how unilaterally the change has been presented, and how there is little evidence of any effort to assess whether the advantages gained by the switch to Harfbuzz was justified the impact caused by the change, but I suppose that's par for the course for GNOME projects.
Gnome people are once again screwing power users.
Font Browsing - GUI Programs
Many people on the internet advise that to see what fonts are installed on a system, or find information about these the fonts like their "proper" name to use in program configuration, one should simply open either a font browsing program or even a word processor and look at the fonts there.
The problem with this approach is that both font browsers and word processors
are applications that go through various toolkit libraries.
For example, on this new system I am installing, font-manager
shows 15 total fonts whereas fc-list shows 620. Even after installing
fonts-terminus-otb font-manager doesn't show any bitmap fonts.
font-manager is a GTK application and is probably affected by Pango's
font filtering. Pango, following the discussion in the bitmap font issue,
implemented some kind of filtering for the fonts it either would select or
would show as existing, so that applications couldn't select unusable fonts
(like the "traditional" bitmap ones). It is likely that an application like
'font-manager' would therefore simply not see the installed "traditional"
bitmap fonts at all as a result. Not very helpful for diagnostics.
Font Browsing - Console Programs
There are two programs that display the fonts installed in the system:
fc-list and xlsfonts.
fc-list is part of fontconfig, and xlsfonts is part of x11-utils.
These programs list the fonts that exist in the system, unfortunately
they do not guarantee that a particular program will be able to use
any of the listed fonts.
Font Browsing - xterm
Turns out, xterm can be a decent font browser. Try:
xterm -fn terminus-12
xterm -fn -xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso8859-1
xterm -fn '-xos4-terminus-medium-r-normal--18-*'
The arguments are the font names as listed by xlsfonts
(reference).
Naturally, xterm only helps if you want to use the font with an application
that uses the X font machinery directly. These selections are not applicable
to e.g. GTK applications that use Pango.
Caches
Both fontconfig and X have font caches. The former is refreshed
by fc-cache -f (or fc-cache -fv if you would like to see the progress
output), the latter is refreshed by xset fp rehash.
I don't currently know when these caches need to be refreshed or where
from and how these refreshes are triggered automatically.