property FontAscent[Index: Integer; FontSize: Single]: Single; // read only
FontAscent reports the ascent metric of the font referenced by the page object at the given index. Ascent is the vertical distance from the baseline up to the highest extent reached by the font's tallest characters (capitals, accents, ascenders such as 'l', 'h', or 'k'). The result is expressed in PDF user-space points, already scaled to the FontSize you pass in.
The Index indexer is the 0-based page-object index (0..ObjectCount - 1). The second indexer, FontSize, is the size in PDF points at which the metric should be computed. Pass the size you intend to render at, or use CharacterFontSize[n] to mirror the size of an existing text run. A page must be active when reading the property.
Together with FontDescent this gives the total line height of the font: LineHeight := FontAscent - FontDescent (descent is typically negative). PDFium returns 0 when the font lacks the metric or when the indexed object is not text.
| Index | 0-based page-object index in the range 0..ObjectCount - 1. |
| FontSize | Font size in PDF points used to scale the metric. Typically the size at which the font will be rendered (e.g. 10.0, 12.0). |
FontSize alone.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;