SubsetEmbeddedFonts
Document Management, Fonts
Description
Rebuilds every embedded simple TrueType font program so it keeps only the glyphs for the character codes that actually occur in the page content. Fonts with descendant fonts (composite CID fonts), fonts that already carry a subset tag in their BaseFont name, and fonts without an embedded FontFile2 are skipped
Syntax
Delphi
Function TPDFlib.SubsetEmbeddedFonts: Integer;Return values
The number of font programs rewritten, or 0 when the selected document has no eligible embedded font
Remarks
The pass collects the single-byte codes each font uses on every page and in every form XObject, so call it after all drawing is complete and before saving. Each code keeps every glyph a viewer could select for it: the glyph its cmap subtables give for the code, its symbol-area form and the Unicode value or Mac Roman code of its encoding glyph name, and the glyph the post table names. Only the outlines of the remaining glyphs are removed; glyph IDs, cmap, post and all other tables stay as they are, so pages render the same
The rewrite is done by the library itself on every platform; it no longer needs the Windows font package API. A font program shared by several font dictionaries, a font used by an interactive form default appearance and a font named by content that does not parse are left unchanged
Fonts embedded by this library are subsetted at insertion time by the automatic subsetting options, so this pass mainly benefits loaded documents whose fonts were embedded in full
Example
PDF.LoadFromFile('full-embed.pdf', '');
PDF.SubsetEmbeddedFonts;
PDF.SaveToFile('subsetted.pdf');See also
OptimizeEmbeddedFonts also optimizes composite (Type0) fonts, re-subsets existing subsets and reports the outcome for each font