Skip to content
Patrick Corless edited this page Nov 3, 2026 · 2 revisions

How icepdf finds fonts: the fonts embedded in a document first, then system fonts that stand in for fonts a document names but doesn't embed.

On this page: Embedded fonts · Substituting missing fonts · The font cache · Fonts from the class path · Writing text into annotations and signatures

Embedded fonts

icepdf reads every kind of embedded font in the PDF specification through Apache FontBox: Type 1, TrueType, OpenType, CFF and Type 3. Since 7.0.0 font rendering is entirely open source.

Substituting missing fonts

When a document names a font without embedding it, icepdf picks the closest installed font, preferring ones whose glyph widths match so text keeps its layout. Installing a few free font families makes a visible difference:

After installing fonts, rescan them: in the viewers, from the preferences; in your own code, with FontManager.getInstance().readSystemFonts(null).

The font cache

icepdf scans the system fonts once and keeps the result in a cache, so later launches start quickly. Since 8.0 the cache is versioned: the first launch after upgrading rescans the fonts once, picking up TrueType and OpenType collections (.ttc/.otc), which are now used for substitution, notably for CJK text. A cache that can't be read rebuilds itself.

Fonts from the class path

To ship fonts with your application instead of relying on what's installed, put them in a package on the class path and load them by name:

// get an instance to the singleton FontManager
FontManager fontManager = FontManager.getInstance();
// read four fonts from the package fonts
fontManager.readFontPackage("fonts", Arrays.asList(
                new String[]{"CenturySchL-Bold.pfb",
                        "Dingbats.pfb",
                        "NimbusMonL-Bold.pfb",
                        "NimbusSanL-Bold.pfb"}));

Writing text into annotations and signatures

When icepdf writes text into a document, in a free-text annotation, a form field or a visible signature, it embeds a subset of the font it used. With icepdf-fonts on the class path it has a known set of fonts to choose from. You only need it if your application writes such text; see Dependencies for the coordinates.

Clone this wiki locally