LinuxCommandLibrary

bdftruncate

Reduce size of BDF fonts

SYNOPSIS

bdftruncate [-v] [-o output-bdf-file] width height [input-bdf-file]

PARAMETERS

-v
    Enable verbose mode.
Outputs details on glyphs processed and truncation applied.

-o file
    Write output to specified BDF file.
Defaults to stdout if omitted.

width height
    Required positive integers (pixels).
Maximum dimensions for all glyphs' bitmaps.

input-bdf-file
    Path to input BDF file.
Uses stdin if not provided.

DESCRIPTION

bdftruncate is a command-line utility for modifying BDF (Bitmap Distribution Format) font files, commonly used in the X Window System for bitmap fonts. It reads an input BDF file (or stdin) and truncates each glyph's bitmap to a user-specified width and height in pixels. Pixels outside these bounds are cropped, and the font's bounding box properties (like INK_WIDTH, FONT_BOUNDING_BOX) are automatically adjusted to match the new dimensions.

This ensures all glyphs fit uniformly within the defined size, which is essential for font servers, embedded systems, or applications requiring consistent metrics. The tool preserves other font attributes such as FAMILY_NAME, WEIGHT_NAME, SLANT, PIXEL_SIZE, and POINT_SIZE where possible, but prioritizes truncation. Output can be directed to a file or stdout, making it suitable for pipeline processing with tools like bdftopcf.

Primarily used in font development workflows to downsize oversized glyphs without manual editing. It processes scalable or fixed-width fonts but works best on monospaced ones to avoid metric inconsistencies. Note that truncation is lossy: fine details or ascenders/descenders may be clipped, potentially affecting readability.

CAVEATS

Truncation crops glyphs destructively, potentially losing details like serifs or accents.
Backup originals first. Width/height must be >0; invalid values cause errors. Not suitable for proportional fonts due to metric shifts.

EXAMPLE

bdftruncate -v -o trunc12.bdf 12 20 fixed.bdf
Truncates fixed.bdf to 12x20 pixels, saves as trunc12.bdf with verbose info.

PIPELINE USAGE

bdftruncate 8 16 | bdftopcf -o small.pcf
Truncate then convert to PCF for X server.

HISTORY

Part of X11 font utilities from X.Org Foundation.
Originated in X11R5/R6 era (1990s) for bitmap font processing; maintained in xfonts-utils package.

SEE ALSO

bdfimplode(1), bdftopcf(1), pcfedit(1), xfontsel(1)

Copied to clipboard