PDFium Component Docs

FontDescent プロパティ

この API エントリでは識別子、シグネチャ、コードブロック、PDF 用語を元の表記のまま保持します。
コンポーネント: TPdf  ·  ユニット: PDFium
page object の font の descent を返します。baseline から最も低い descender までの距離を表し、PDF points で、呼び出し側が指定した font size に応じて scale されます

構文

property FontDescent[Index: Integer; FontSize: Single]: Single; // read only

説明

FontDescent は、指定した index の page object が参照する font の descent metric を返します。descent は baseline から descender が到達する最下点までの垂直距離で、PDF metric では通常負の値になります。PDFium が返す値は、FontSize 引数に合わせて PDF user-space points へ既に scale されています

Index indexer は 0-based の page-object index で、範囲は 0..ObjectCount - 1 です。FontSize は metric を計算したい大きさで、描画時の size か、既存 text を再現するときは CharacterFontSize が返す値を渡してください。property を読む前に page を active にしておく必要があります

FontAscent と組み合わせると、選んだ size における font の total line height が得られます: LineHeight := FontAscent - FontDescent。基礎 font がこの metric を公開しない場合 (一部の Type3 fonts など) や page object が text でない場合、PDFium は 0 を返します

パラメータ

Index0-based page-object index in the range 0..ObjectCount - 1.
FontSizeFont size in PDF points used to scale the metric (e.g. 12.0). Match it to the actual rendering size for a realistic descender value.

備考

var
  I: Integer;
  Asc, Dsc, LineHeight: Single;
begin
  Pdf1.PageNumber := 1;
  for I := 0 to Pdf1.ObjectCount - 1 do
  begin
    Asc := Pdf1.FontAscent[I, 12.0];
    Dsc := Pdf1.FontDescent[I, 12.0];
    LineHeight := Asc - Dsc;
    if LineHeight > 0 then
      Memo1.Lines.Add(Format('Object %d: line height = %.2f pt', [I, LineHeight]));
  end;
end;

関連項目

FontAscent, FontSize, FontHandle, FontFamilyName