EnumDocumentFonts

Fonts

Description

Enumerates every /Font dictionary in the loaded document and fills one TPDFlibDocumentFont record per font with its /BaseFont name, type, encoding and embedding status, so a font inventory no longer needs repeated SelectFont calls with scalar getters

The function runs FindFonts first (idempotent, a second call only adds previously unseen dictionaries), then walks every discovered font, including fonts whose program is not embedded

Syntax

Delphi

Function TPDFlib.EnumDocumentFonts(Var Fonts: Array Of TPDFlibDocumentFont): Integer;

Parameters

FontsCaller-allocated array of TPDFlibDocumentFont records; only as many entries as the array holds are written

Return values

>= 0The total font count of the document; when the caller's array holds fewer elements only the first Length(Fonts) entries are written and the return value may exceed the number of written entries, matching EnumAttachments
0No document is loaded or the document contains no fonts

Remarks

Each record's FontID is the 1-based handle accepted by SelectFont, and the caller's currently selected font is preserved across the call

Encoding carries the textual /Encoding name such as WinAnsiEncoding or Identity-H; FontFileBytes is the encoded length of the embedded font program (/FontFile, /FontFile2 or /FontFile3) and is zero when the font is not embedded

See also

TPDFlibDocumentFont, EnumAttachments, FindFonts, GetDocumentFontDiagnostics, SelectFont