Home / Alt manpages / psfstriptable(1)

  • psfstriptable(1)
  • User command
  • linux

Strip a Unicode Table from a PSF Console Font Safely

You will finish with a second PSF console font that has its embedded Unicode character table removed, while keeping the source font untouched for recovery. The examples use psfstriptable from kbd 2.6.4-2ubuntu2. Allow about ten minutes, plus time to identify the correct font. You need a shell and a PSF font file. No elevated privileges are required when you work in a directory you can write.

A Unicode table maps glyph positions in a console font to character values. Removing it can make a font smaller, but it also removes that mapping from the output file. This command does not edit the input in place: it takes an input path and a separate output path.

1. Check the installed command

Confirm that the command is installed and inspect its short usage message:

$ command -v psfstriptable
/usr/bin/psfstriptable
$ dpkg-query -W -f='${Package} ${Version}\n' kbd
kbd 2.6.4-2ubuntu2
$ psfstriptable --help
Usage: psfstriptable infont outfont

The interface is deliberately small. The first argument is the input font and the second is the output font. There are no mode switches to add. If --help prints a different usage line on another kbd release, follow that installed command's syntax.

2. Choose a PSF input and a new output path

Do not point the output at the source until you have checked the command's result and made a backup. A separate output path gives you a straightforward recovery path: discard the derived file and continue using the original.

Many distributions install compressed console fonts, such as .psf.gz. psfstriptable reads a PSF font, not a gzip stream, so decompress a copy first. This example uses a font installed by the kbd package and writes temporary working files:

$ workdir=$(mktemp -d)
$ gzip -cd /usr/share/consolefonts/Lat15-Terminus16.psf.gz \
    > "$workdir/input.psf"
$ ls -lh "$workdir/input.psf"
-rw-r--r-- 1 user user 5.6K ... input.psf

The size and ownership in the listing vary. The important checkpoint is that the decompression succeeded and the input is a regular file. Replace the source path with the font you actually intend to process. Treat a font obtained from an untrusted source as data to inspect, not as a reason to run unrelated commands as root.

3. Produce the stripped font

Run the command with the input and output paths in that order:

$ psfstriptable "$workdir/input.psf" "$workdir/stripped.psf"
$ ls -lh "$workdir/input.psf" "$workdir/stripped.psf"
-rw-r--r-- 1 user user 5.6K ... input.psf
-rw-r--r-- 1 user user 4.1K ... stripped.psf

A successful run is quiet and returns status 0. The exact sizes depend on the font and its table. Do not treat a smaller file as the only proof of success: a different PSF font may already lack a table, or may have a table whose size differs.

Checkpoint

Keep input.psf until the stripped font has passed the checks below. If you accidentally choose the wrong input, remove only the derived output and start again with the correct source. Nothing in this workflow requires a service restart or a change to a system font configuration.

4. Verify that the table is gone

Use psfgettable to extract a readable representation before and after stripping. This is a read-only check of both files:

$ psfgettable "$workdir/input.psf" "$workdir/before.txt"
$ psfgettable "$workdir/stripped.psf" "$workdir/after.txt"
$ wc -c "$workdir/before.txt" "$workdir/after.txt"
5281 /tmp/tmp.example/before.txt
1834 /tmp/tmp.example/after.txt
7115 total
$ sed -n '1,5p' "$workdir/after.txt"
#
# Character table extracted from font
#
0x000	
0x001	

The exact byte counts and temporary directory name will differ. For a font that contained mappings, the pre-strip extraction shows character values such as U+00a9; the post-strip extraction has empty mapping fields. An empty table before the operation means there was nothing useful to remove, so investigate the input selection rather than assuming the command repaired it.

5. Use standard input and output when needed

The manpage defines a single hyphen as standard input or standard output. This lets you keep the intermediate font out of a permanent directory:

$ psfstriptable - - < "$workdir/input.psf" > "$workdir/stdout.psf"
$ cmp "$workdir/stripped.psf" "$workdir/stdout.psf"
$ printf 'comparison status: %s\n' "$?"
comparison status: 0

Here, the first hyphen means read from standard input and the second means write to standard output. The cmp result of 0 means the two derived files are byte-identical for this run. Keep shell redirections visible: a misplaced > can create or truncate a file before the program starts.

6. Install or deploy only after review

If the stripped file is for a system console, copy it into the location used by your font-loading configuration only after testing it with your normal font workflow. Copying into a system directory may require sudo; the stripping operation itself does not. A deployment can affect console readability, so keep the original file and record its path before changing a boot or service configuration.

There is no undo option for psfstriptable. Recovery is simple while the source exists: stop using the derived font and restore the original PSF file or the previous configuration. If you only have a compressed source, recreate the working copy with gzip -cd rather than trying to reconstruct the removed Unicode table from the stripped output.

Done means

  • The installed kbd version and command syntax were checked.
  • The source was a PSF file, with any gzip compression removed first.
  • The output used a separate path, leaving the source available.
  • psfgettable showed mappings before stripping and empty mapping fields afterwards, where a table was present.
  • Standard input and output were used only with explicit hyphen arguments and safe redirections.
  • Any system installation will be treated as a separate, reversible deployment step.