property FontAscent[Index: Integer; FontSize: Single]: Single; // read only
FontAscent は、指定 index の page object が参照する font の ascent metric を返します。ascent は baseline から font の最も高い文字 (大文字、accent、'l', 'h', 'k' のような ascender) の先端までの垂直距離です。結果は PDF user-space point で返され、FontSize に合わせてすでに scale されています
Index indexer は 0 基準の page-object index です (ObjectCount - 1 まで)。2 つ目の indexer である FontSize は、metric を計算する PDF point の size です。実際に render したい size を渡すか、CharacterFontSize[n] を使って既存の text run に合わせてください。property を読むときは page が active である必要があります
FontDescent と合わせると font の総 line height が分かります。LineHeight := FontAscent - FontDescent です (descent は通常 negative です)。font に metric がないか、index した object が text でないとき、PDFium は 0 を返します
| Index | 0 基準の page-object index です。範囲は 0..ObjectCount - 1 です |
| FontSize | metric を scale するための PDF point の font size です。通常は実際に render する size です (たとえば 10.0, 12.0) |
FontSize だけでなく ascent と descent の両方を使ってください0 を返します。必ずこれに備えてくださいvar
I: Integer;
Asc: Single;
begin
Pdf1.PageNumber := 1;
for I := 0 to Pdf1.ObjectCount - 1 do
begin
Asc := Pdf1.FontAscent[I, 12.0];
if Asc > 0 then
Memo1.Lines.Add(Format('Object %d: ascent = %.2f pt', [I, Asc]));
end;
end;