Home / Alt manpages / ppmdmkfont(1)

  • ppmdmkfont(1)
  • User command
  • linux

Create and Verify a Standard Ppmdfont with ppmdmkfont

You will finish with a standard Netpbm Ppmdfont file that you can keep as an input for font-related tools or use as a reference while creating another font. The installed Netpbm package here is version 2:11.05.02-1.1build1. In this version, ppmdmkfont takes no input and has no documented options: it writes the same generated font each time.

Allow about ten minutes. You need a shell, the netpbm package and a writable working directory. The command normally needs no elevated privileges. This guide does not replace an existing font, install anything, or change a system font directory.

1. Confirm the installed command

Check the executable and package version before building a file. These are ordinary, read-only commands:

$ command -v ppmdmkfont
/usr/bin/ppmdmkfont
$ dpkg-query -W -f='${Package} ${Version}\n' netpbm
netpbm 2:11.05.02-1.1build1

The exact package version will vary between distributions. The important check is that the command resolves to the Netpbm executable you intend to run. If command -v prints nothing, install Netpbm through your normal package-management process before continuing. Do not compensate by running an unknown copy from the current directory.

Checkpoint

You have an executable path and a package version. The remaining commands write only to the output path you choose.

2. Choose a new output path

ppmdmkfont does not accept an output filename. Its generated Ppmdfont data goes to standard output, so shell redirection supplies the destination:

$ mkdir -p "$HOME/netpbm-font-work"
$ output="$HOME/netpbm-font-work/standard.pmdfont"
$ printf '%s\n' "$output"
/home/you/netpbm-font-work/standard.pmdfont

Replace the example directory with a directory you own. The mkdir -p command is safe when the directory already exists, but it does not grant access to a protected location. If you choose a system directory such as /usr/local/share, you may need elevated privileges for the final copy, not for font generation. Prefer a user-owned staging directory while testing.

Safety warning

Avoid redirecting straight to a path that contains a useful font. The shell truncates the destination before the program runs, so a failed command can destroy the previous file. Use a new name or the temporary-file pattern below.

3. Generate the font without overwriting the destination

Write to a temporary file in the same directory, then move it into place only after the command succeeds:

$ temporary="$output.tmp"
$ ppmdmkfont > "$temporary" && mv -- "$temporary" "$output"
$ printf 'exit status: %s\n' "$?"
exit status: 0

The command has no input file and no normal progress output. A status of zero means the generator and the move completed. Because temporary and output are in the same directory, the final rename is a clear hand-off on normal local filesystems. It also means the old destination, if any, remains until the generated file is ready.

If the generator fails, the && prevents mv from running. Inspect the error, then keep or remove the incomplete temporary file deliberately. Removing it is irreversible, so first confirm it is the temporary path you created:

$ ls -l -- "$temporary" "$output" 2>/dev/null || true

If you used a new output path, recovery is simple: leave the old file untouched and choose another temporary name. If you intentionally replaced an existing file, restore it from your own backup or snapshot. ppmdmkfont has no undo operation because it only generates output; the shell redirection and move determine what is replaced.

4. Confirm that output was created

Check that the destination is a regular, non-empty file. These checks do not interpret the font and do not require root:

$ test -s "$output" && echo 'font file is non-empty'
font file is non-empty
$ wc -c -- "$output"
3899 /home/you/netpbm-font-work/standard.pmdfont
$ file -- "$output"
/home/you/netpbm-font-work/standard.pmdfont: data

The byte count is an observation from the installed build, not a portable contract. It may differ with a different Netpbm release or build. Likewise, file may report only data, because Ppmdfont is a Netpbm-specific binary format rather than a common image format. Do not expect a PPM header, readable text, or a filename embedded in the output.

For a quick repeatability check, generate a second file and compare it with the first:

$ second="$output.second"
$ ppmdmkfont > "$second"
$ cmp -- "$output" "$second"
$ printf 'identical output: %s\n' "$?"
identical output: 0

cmp prints nothing when the files match and returns zero. If it reports a difference, stop and investigate the executable, filesystem errors and the commands you actually ran. Do not use a visual image viewer: this is a font data file, not a PPM image.

5. Inspect the font with the companion dumper

Netpbm's ppmddumpfont reads a Ppmdfont file from standard input and writes a human-readable description to standard error. It also has no documented arguments or options, so feed it with a pipe:

$ ppmdmkfont | ppmddumpfont
... human-readable font description ...

The exact description and line layout are implementation output, not a stable interface to parse in a script. The useful result is that the companion program can consume the generated stream without reporting a header or format error. If you saved the file already, use:

$ ppmddumpfont < "$output"
... human-readable font description ...

Keep the dump separate from the generated file. The dumper writes its report to standard error, so redirecting only standard output will not capture what you see on the terminal:

$ ppmddumpfont < "$output" 2> "$output.dump"
$ test -s "$output.dump" && echo 'font description captured'
font description captured

6. Use the result for its intended purpose

The standard font is built into libnetpbm, according to the manual. That means generating this file is mainly useful as an example or as a concrete Ppmdfont input for tools that work with font files. It does not install the font into Netpbm, alter libnetpbm, or make a new font the system default.

Do not copy the file into a shared system directory just to make it exist there. If another program needs a path, pass it the staged file or copy it into that program's documented data directory during a planned change. A copy into a protected directory may require sudo; inspect the destination and ownership first, and preserve the original until the consumer has been tested.

When you no longer need the test artefacts, review the exact paths before deleting them:

$ printf '%s\n' "$output" "$second" "$output.dump"
/home/you/netpbm-font-work/standard.pmdfont
/home/you/netpbm-font-work/standard.pmdfont.second
/home/you/netpbm-font-work/standard.pmdfont.dump

Delete only files you recognise. The generated font itself can be recreated, but any unrelated file with the same name cannot be recovered by ppmdmkfont.

Done means

  • ppmdmkfont resolves to the intended Netpbm installation and its version is recorded.
  • A non-empty Ppmdfont file exists at a path you control.
  • The file was created through a temporary path, so a failed generation could not truncate the chosen destination.
  • A second generation compared identical on the installed build.
  • ppmddumpfont consumed the data when a readable inspection was needed.
  • No system directory, package installation or persistent Netpbm configuration was changed.