property FontDescent[Index: Integer; FontSize: Single]: Single; // read only
FontDescent 返回给定索引处页面对象所引用字体的下降量。Descent 是从基线向下到下伸部字形所达到最低位置的垂直距离,在 PDF 度量中通常为负值,例如 'g'、'p' 或 'y' 的尾部。PDFium 返回的值已经按 FontSize 参数缩放为 PDF 用户空间点
Index 索引器是 0 基页面对象索引,范围为 0..ObjectCount - 1。FontSize 是计算该度量时使用的字号;可传入你计划渲染时使用的字号,或者在还原现有文本时传入 CharacterFontSize 返回的值。读取该属性前页面必须处于活动状态
与 FontAscent 一起,descent 可给出某个字号下字体的总行高:LineHeight := FontAscent - FontDescent。当底层字体不提供该度量,例如某些 Type3 字体,或者页面对象不是文本时,PDFium 返回 0
| Index | 0 基页面对象索引,范围为 0..ObjectCount - 1 |
| FontSize | 用于缩放该度量的 PDF 点字号,例如 12.0,请与实际渲染字号保持一致,以获得更真实的下伸部数值 |
Abs(FontDescent[...])FontSizevar
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;