LinuxCommandLibrary

pf2afm

Convert PostScript fonts to AFM format

SYNOPSIS

pf2afm [-1|-2|-3|-4] [-c] [-l] [-s] [-v] pfm_file [afm_file]

PARAMETERS

-1
    Emulate Courier (fixed width font).

-2
    Emulate Helvetica (proportional).

-3
    Emulate Times-Roman (proportional).

-4
    Emulate Symbol font.

-c
    Copy FontName directly from PFM.

-l
    Include ligature definitions.

-s
    Slant font to simulate italic.

-v
    Enable verbose output.

DESCRIPTION

pf2afm is a utility from the Ghostscript suite that converts Printer Font Metrics (.pfm) files—used in Windows printer drivers for TrueType and bitmap fonts—into Adobe Font Metrics (.afm) files for PostScript Type 1 fonts.

This conversion extracts character widths, kerning pairs, ligatures, and bounding box data from the compact PFM binary format into the human-readable ASCII AFM format. AFM files enable accurate font scaling, positioning, and subsetting in PostScript interpreters, PDFs, and TeX systems.

Common use cases include adapting Windows fonts for Unix printing, embedding metrics in PostScript jobs, or integrating with tools like dvips or ps2pdf. The tool emulates font families via options and supports basic transformations like slanting for italics. It processes one file at a time, writing output to stdout or a specified file.

Note that pf2afm handles metrics only—no glyph outlines or bitmaps are converted, limiting it to metric-driven rendering.

CAVEATS

Metrics only—no glyph outlines or embedding. Font family options (-1 to -4) override PFM names and may not match exactly. Limited to standard PFM features; complex kerning or Unicode may fail.

EXAMPLES

pf2afm arial.pfm arial.afm
pf2afm -3 -s -l times.pfm timesi.afm
pf2afm -v -c courier.pfm | grep FontName

INPUT/OUTPUT

pfm_file required (.pfm extension optional). Output to afm_file or stdout if omitted.

HISTORY

Introduced in early Ghostscript versions (pre-1996) by developers like Thomas Helm to bridge Windows printer fonts with PostScript. Evolved with Ghostscript (now 10.x) for better PFM parsing and TeX integration.

SEE ALSO

gs(1), pfbtopfa(1), afm2pl(1), ttf2pt1(1)

Copied to clipboard