PDFiumPas 文件

FontData 屬性

此 API 條目保留識別符號、簽名、程式碼塊和 PDF 術語的原始形式。
元件: TPdf  ·  單元: PDFium
對內嵌字型程式原始位元組的唯讀索引存取(僅在字型已內嵌時有內容)

語法

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

說明

傳回內嵌字型程式的原始位元組(僅在字型已內嵌時有內容)。此屬性以從字元取得的字型處理常式(FontHandle[CharIndex])為索引,或可直接透過頁面的字型資源枚舉取得

唯讀。底層值會由 PDFium 以延遲方式從字型字典或字型程式查詢。當索引不對應任何已知字型時,函式會拋出 EPdfError

可將此屬性與 CharacterFontSize / CharacterFontWeight 一起使用,以驅動字型替換或文字樣式重建流程

參數

FontIndex字型處理常式的索引。可透過 FontHandle[CharIndex] 或枚舉頁面字型資源取得

備註

範例

var

  FontIdx: Integer;

begin

  // inspect the font used by the first character

  if Pdf1.CharacterCount > 0 then

  begin

    FontIdx := Pdf1.FontHandle[0];

    Memo1.Lines.Add(Format('%s (embed=%s)',

      [Pdf1.FontFamilyName[FontIdx], BoolToStr(Pdf1.FontIsEmbedded[FontIdx], True)]));

  end;

end;

另請參閱

FontSize, FontWeight, FontFamilyName, FontIsEmbedded, CharacterFontSize