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 walks every content layer of every page and collects the used single-byte codes per font before rebuilding, so call it after all drawing is complete and before saving
When a content font resource cannot be resolved uniquely to one font dictionary the superset of used codes is kept, which stays correct at the cost of less size reduction
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');