Ubuntu – How to activate bitmap fonts on 20.04

20.04fonts

I am using Ubuntu Mate 20.04. I want to use the Fixed 6×13 font in the terminal (not xterm). When I try to change the terminal font, the Fixed fonts are not in the list of available fonts. However, mate-font-viewer and and xfontsel show the Fixed fonts.

I followed the instructions how to enable this font in How can I activate bitmap fonts? and https://ubuntuforums.org/showthread.php?t=1270870. None of the provided solutions seems to work. This is what I did so far:

  • I installed the xfonts-100dpi and xfonts-75dpi packages.
  • In /etc/fonts/conf.d/ I deleted 70-no-bitmaps.conf and added the 70-yes-bitmaps.conf or 70-force-bitmaps.conf symbolic link. I tried both, one at a time.
  • Following the instructions on https://ubuntuforums.org/showthread.php?t=1270870 I specifically enabled the Fixed font family by adding a 69-fixed-bitmaps.conf.
  • On every trial I ran dpkg-reconfigure fontconfig-config, dpkg-reconfigure fontconfig and fc-cache -f and rebooted my system.

How can I use these fonts on Ubuntu 20.04?

Best Answer

Ubuntu 20.04 requires bitmap fonts to be manually enabled, and the bitmap font file must be in the OpenType Bitmap (otb) format.

Enable bitmap fonts:

$ rm /etc/fonts/conf.d/70-no-bitmaps.conf
$ ln -s ../conf.avail/70-force-bitmaps.conf /etc/fonts/conf.d/
$ dpkg-reconfigure fontconfig-config
$ dpkg-reconfigure fontconfig
$ fc-list | grep Fixed | grep 6x13.pcf
/usr/share/fonts/X11/misc/6x13.pcf.gz: Fixed:style=SemiCondensed
/usr/share/fonts/X11/misc/trad--6x13.pcf.gz: Fixed:style=SemiCondensed

If you do not have an otb font, then it is necessary to convert from a bdf font (conversion from a pcf font will result in incorrect sizing). This conversion can be done using fonttosfnt. Unfortunately the version of fonttosfnt in Ubuntu 20.04.1 is buggy and outputs fonts with incorrect spacing (see 1, 2), so use of the latest git code is necessary.

Install latest fonttosfnt from git:

$ git clone https://gitlab.freedesktop.org/xorg/app/fonttosfnt.git
$ apt-get build-dep xfonts-utils
$ cd fonttosfnt
$ ./autogen.sh
$ ./configure
$ make

Download 6x13.bdf, rename to avoid collision with .pcf font, and convert to otb format:

wget https://opensource.apple.com/source/X11fonts/X11fonts-14/font-misc-misc/font-misc-misc-1.1.2/6x13.bdf
sed -i 's/FAMILY_NAME.*/FAMILY_NAME "MyFixed"/' 6x13.bdf
./fonttosfnt -b -c -g 2 -m 2 -o myfixed.otb 6x13.bdf

Install new otb font:

$ cp myfixed.otb /usr/local/share/fonts
$ dpkg-reconfigure fontconfig-config
$ dpkg-reconfigure fontconfig
$ fc-list | grep otb
/usr/local/share/fonts/myfixed.otb: MyFixed:style=SemiCondensed

Start app, choose font, search for "myfixed".