Converting BDF/PCF bitmap fonts to OTB bitmap fonts

Table of Contents

Applications that use Pango (the software) cannot use good ol' X bitmap font formats anymore.

But they still can use the OTB format for bitmap fonts.

If your favorite old bitmap font is not available in this format, here's how to convert it.


For once I found the instructions on Fedora's wiki, not Archlinux'.

Save this script to a file and make it executable.

Install fonttosfnt and ftdump according to your distro.


fonttosfnt is an AUR package. First, add the maintainer's public PGP key: gpg --recieve-keys E23B7E70B467F0BF, then install the AUR package with the method of your choice.

ftdump is not a separate package but contained in the freetype2-demos package. Install with pacman.


Let's use this font as an example.

git clone

If I follow the instructions from the Fedora wiki I end up with buggy multi-size OTB fonts that work only at one size:

./ terv-terc/bdf/terv*.bdf

This might well be the font creator's (me) fault for not considering all options while creating the original BDF fonts; however, you will find that many of those oldschool nerdy bitmap fonts are equally amateurish.

Instead I try to create single-size OTB fonts. This works in principle, but the script overwrites different sizes because the size is not part of the naming scheme:

for f in terv-terc/bdf/terv*bdf; do ./ $f; done

That's not good either.

This is how I solved it:

for f in terv-terc/bdf/terv*bdf; do size="$(grep -w ^PIXEL_SIZE "$f" | cut -d' ' -f2)" name="$(grep -w ^FAMILY_NAME "$f" | cut -d' ' -f2)" name="${name#\"}" name="${name%\"}" sed "s/^FAMILY_NAME .*/FAMILY_NAME \"$name-$size\"/" "$f" > "$f".tmp ./ "$f".tmp rm "$f".tmp done

Temporarily change the FAMILY_NAME inside the *.bdf files so that it includes the pixel size. It will result in a separate OTB font file for each size/style/name combination.


The results of this article have now been incorporated into the TerV/TerC repository.