PDFium Component Docs

FontHandle プロパティ

この API エントリでは識別子、シグネチャ、コードブロック、PDF 用語を元の表記のまま保持します。
コンポーネント: TPdf  ·  ユニット: PDFium
page object が使う font の native FPDF_FONT handle を返します。この handle により、component では wrapper されていない PDFium font API に advanced caller が直接アクセスできます

構文

property FontHandle[Index: Integer]: FPDF_FONT; // read only

説明

FontHandle は、指定した index の text page object に対応する raw PDFium font pointer (FPDF_FONT) を返します。内部的には FPDFTextObj_GetFont が返す値そのもので、TPdf 上の他の Font* property である FontAscent, FontDescent, FontFamilyName, FontBaseName, FontIsEmbedded, FontItalicAngle, FontWeight, FontData はすべてその上にある convenience wrapper です

index は 0-based の page-object index で、範囲は 0..ObjectCount - 1 です。font を持つのは text object だけで、image, path, shading object ではこの呼び出しは nil を返します。property を読む前に page を active にしておく必要があります

返される handle は PDFium が所有し、現在 page が loaded の間だけ有効です。free したり、page 変更をまたいで保持したり、破壊的な PDFium API を向けたりしないでください。opaque な read-only token として扱ってください

パラメータ

Index0-based page-object index. Use ObjectType first to confirm the object is text; non-text objects return nil.

備考

var
  I: Integer;
  H: FPDF_FONT;
begin
  Pdf1.PageNumber := 1;
  for I := 0 to Pdf1.ObjectCount - 1 do
  begin
    H := Pdf1.FontHandle[I];
    if H <> nil then
      Memo1.Lines.Add(Format('Object %d uses font %s',
        [I, Pdf1.FontFamilyName[I]]));
  end;
end;

関連項目

FontFamilyName, FontBaseName, FontIsEmbedded, FontData, ObjectCount, ObjectType