THotPDF.CompactFontSubsetting

THotPDF

 

Properties  EnableFontSubsetting  FontEmbedding

Controls whether font subsets renumber the glyphs they keep, which makes them much smaller.

 

Delphi syntax:

property CompactFontSubsetting: Boolean;

 

C++ syntax:

__property bool CompactFontSubsetting;

 

Description

Set CompactFontSubsetting to true before BeginDoc to build compact font subsets. A normal subset keeps the glyph numbering of the source font: unused glyphs are emptied, but the font still declares every glyph and carries a location and width entry for each one. For a CJK face with 20,000 to 30,000 glyphs those tables alone add over 200 KB before compression, even when the page shows two characters

 

A compact subset renumbers the kept glyphs into a dense range and rebuilds the glyph tables for them only. The page content still shows the original glyph numbers as CIDs, and an explicit /CIDToGIDMap stream (ISO 32000-1 9.7.4.2) maps them to the renumbered glyphs, so text, widths and text extraction are unchanged. Two Chinese characters in SimSun take about 25 KB of font data in a normal subset and about 3 KB in a compact one

 

The property applies to TrueType faces written as Type 0 fonts, when EnableFontSubsetting is on, and to the face registered with RegisterUnicodeTTF, which is always subset. OpenType-CFF faces keep the normal subset. If a compact subset cannot be built for a font, HotPDF falls back to the normal subset

 

The property is off by default, so existing output is unchanged. Under PDF/A the registered face always gets a compact subset. A compact subset suits final output best: text added to the document later with the same font needs a new subset, and documents merged later cannot share the subset of the same font

 

See also: EnableFontSubsetting, FontEmbedding, RegisterUnicodeTTF