PDFium Delphi Component Docs

FontData property

Component: TPdf  ·  Unit: PDFium
Read-only indexed access to the raw bytes of the embedded font program (only filled in when the font is embedded)

Syntax

property FontData[Index: Integer]: TBytes; // read only

Description

Returns the raw bytes of the embedded font program for the text page object at Index (only filled in when the font is embedded). The valid range is 0 .. ObjectCount - 1 for a text object on the current page

Read-only. PDFium queries the underlying value lazily from the font dictionary or font program. When the index does not match a known font, the function raises EPdfError

Use this property together with CharacterFontSize / CharacterFontWeight to drive font-substitution or text-style reconstruction pipelines

Parameters

IndexZero-based page object index in 0 .. ObjectCount - 1 referencing a text object (ObjectType[Index] = otText)

Remarks

Example

var
  I: Integer;
  RawFont: TBytes;
begin
  for I := 0 to Pdf1.ObjectCount - 1 do
    if Pdf1.ObjectType[I] = otText then
    begin
      RawFont := Pdf1.FontData[I];
      Memo1.Lines.Add(Format('%s (%d bytes)', [Pdf1.FontFamilyName[I], Length(RawFont)]));
    end;
end;

See Also

FontSize, FontWeight, FontFamilyName, FontIsEmbedded, CharacterFontSize