property FontDescent[Index: Integer; FontSize: Single]: Single; // read only
FontDescent 报告给定索引处页面对象所引用字体的下降量。下降量是从基线到下降部(如 'g'、'p' 或 'y' 的尾部)所达到的最低点的垂直距离(在 PDF 度量中通常为负)。PDFium 返回的值已按 FontSize 参数缩放,单位为 PDF 用户空间点
Index 索引器是基于 0 的页面对象索引(0..ObjectCount - 1)。FontSize 是你想要计算该度量的字号;传入你打算渲染的字号,或者在重现现有文本时传入 CharacterFontSize 返回的值。读取该属性之前页面必须处于活动状态
与 FontAscent 结合,下降量给出了字体在所选字号下的总行高:LineHeight := FontAscent - FontDescent。当底层字体不暴露该度量(例如某些 Type3 字体)或页面对象不是文本时,PDFium 返回 0
| Index | 0..ObjectCount - 1 范围内的基于 0 的页面对象索引 |
| 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;