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 を返します
| Index | 0-based page-object index in the range 0..ObjectCount - 1. |
| FontSize | Font 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. |
Abs(FontDescent[...]) when you need the absolute drop below the baseline.FontSize on the line when sizing a row.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;