An X server cannot read a BDF font directly, so bdftopcf compiles that source into a Portable Compiled Format file it can load. The examples use bdftopcf 1.1 from the Debian package xfonts-utils version 1:7.7+6build3. Allow about ten minutes if the BDF file is ready and you only need a standard conversion.
fontfile.bdf, and write access to a separate output directory.sudo unless your input or destination permissions genuinely require it.$ command -v bdftopcf
/usr/bin/bdftopcf
$ bdftopcf -v
bdftopcf 1.1
The installed manual describes this as a font compiler for the X server and font server. PCF files are portable between architectures, although a file can be read more quickly when its layout suits the host. The version check matters when a build script or an old font archive has to be reproduced later.
Checkpoint: if the command is missing, stop here and install the distribution package that provides bdftopcf through your normal package-management process. Do not download a random executable into a font directory.
$ bdftopcf -o ./output-font.pcf ./fontfile.bdf
$ printf 'status=%s\n' "$?"
status=0
$ ls -l ./output-font.pcf
fontfile.bdf is the positional input. With -o, the compiled PCF is written to the named file.-o, bdftopcf writes the PCF bytes to standard output, useful for a deliberate redirection but easy to mistake for a missing output file.Checkpoint: use file ./output-font.pcf or the font inspection tool available on your system for a second check. A successful exit status means the compiler completed; it does not prove the glyph design is what you intended, so keep the BDF until the PCF has been tested by the consumer.
$ bdftopcf -o ./output-font.pcf.new ./fontfile.bdf
$ test -s ./output-font.pcf.new
$ mv ./output-font.pcf.new ./output-font.pcf
-o names an output file, but it is still safer to use a fresh temporary name when replacing an existing PCF. This protects the old file if the conversion fails or you decide the result is wrong. Run the mv only after the conversion and the non-empty-file check succeed; if conversion fails, inspect the diagnostic and leave the old PCF alone. To recover an unwanted replacement before another process uses it, restore your own backup or regenerate the known-good PCF from the original BDF. The mv example changes state in the current directory, so review both names before running it.
If you deliberately want standard output instead, use an explicit new file:
$ bdftopcf ./fontfile.bdf > ./output-font.pcf
$ printf 'status=%s\n' "$?"
status=0
Warning: shell redirection opens the destination before the program runs. Never use this form with the only copy of a useful PCF unless you have a backup. The -o workflow with a .new name makes the replacement boundary easier to see.
$ bdftopcf -p 4 -o ./output-font-p4.pcf ./fontfile.bdf
-p sets glyph scanline padding to 1, 2, 4 or 8 bytes. This changes how each glyph scanline is padded in the compiled font: a format and consumer-compatibility choice, not a visual resize.-u is different: it sets the scanline unit to 1, 2 or 4 bytes for byte swapping when font bit order differs from byte order:
$ bdftopcf -u 4 -o ./output-font-u4.pcf ./fontfile.bdf
Only add these options when the target X implementation or an existing reproducible build requires them. If the option value is outside the documented set, the installed compiler rejects it; correcting an invalid value is safer than trying several combinations against a production font directory.
The default conversion does not require you to choose an order manually. The explicit switches are:
-m writes glyph bits most significant bit first.-l writes glyph bits least significant bit first.-M writes multi-byte data most significant byte first.-L writes multi-byte data least significant byte first.These are different choices: bit order controls the position of bits within each unit, while byte order controls multi-byte values such as metrics and bitmap data. Do not add all four flags to make a conversion seem more portable. Select the documented combination for the X server or font tooling that will consume the PCF, and keep that choice in the build command so it can be reproduced.
$ bdftopcf -t -o ./terminal-font.pcf ./fontfile.bdf
-t asks bdftopcf to convert the font into terminal form when possible. Terminal fonts pad each glyph image to the same size, which can let an X server render them more quickly. This is an output-layout optimisation, not a guarantee every font becomes a terminal font.-t inhibits that.-i inhibits the normal ink-metric computation on its own, without asking for terminal conversion:
$ bdftopcf -i -o ./no-ink-metrics.pcf ./fontfile.bdf
These flags can change spacing or the way glyph extents are understood by software. Test the resulting font with the actual application. If you only need a normal PCF, omit both options.
$ ls -l ./fontfile.bdf
$ test -r ./fontfile.bdf && echo readable
$ test -w . && echo destination-writable
Check the input path and permissions first, without changing the font archive. If the compiler reports it cannot open the BDF source, correct the path or read permission. If it cannot create the PCF, choose a writable destination or fix the destination permission according to your system policy. Running the whole conversion as root can hide an ownership problem and can leave root-owned output behind, so it should not be the first remedy.
For an option error, compare the command with the local manual. The documented values are narrow: -p accepts 1, 2, 4 or 8, and -u accepts 1, 2 or 4. The compiler has no documented input-directory mode, font installation mode or automatic overwrite safeguard. Keep conversion and installation as separate, reviewable operations.
bdftopcf -v reported the installed compiler version.