property FontDescent[Index: Integer; FontSize: Single]: Single; // read only
FontDescent reports the descent metric of the font referenced by the page object at the given index. Descent is the vertical distance (typically negative in PDF metrics) from the baseline to the lowest point reached by descenders such as the tails of 'g', 'p', or 'y'. The value PDFium returns is already scaled to the FontSize argument, in PDF user-space points.
The Index indexer is the 0-based page-object index (0..ObjectCount - 1). FontSize is the size at which you want the metric computed; pass either the size you intend to render at or, when reproducing existing text, the value returned by CharacterFontSize. A page must be active before the property is read.
Combined with FontAscent the descent gives the total line height of a font at a chosen size: LineHeight := FontAscent - FontDescent. PDFium returns 0 when the underlying font does not expose the metric (for example, certain Type3 fonts) or when the page 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 (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;