FontSize is an alias for CharacterFontSize retained for backward compatibility.property FontSize[Index: Integer]: Double; // read only
FontSize reports the effective glyph height that PDFium computed for the character at the given index, expressed in PDF user-space points (1 pt = 1/72 inch). The value already incorporates the font's selected size and the current text-state scaling, so it is the size the character would render at if the page were printed at its natural scale.
The index is the 0-based position of the character in the current page's text page, in the same order returned by Character and produced by Text. Valid values run from 0 to CharacterCount - 1. Before reading the property you must load a page (PageNumber); the text page is created automatically on first access.
Different runs of text on the same page can have different sizes, even within a single line, so the size must be queried per character rather than per page. Note that this size is unrelated to the metrics returned by FontAscent / FontDescent, which describe the font itself; FontSize describes how a specific glyph instance is sized.
| Index | 0-based character index in the current page, in the range 0..CharacterCount - 1. |
FontSize.var
I: Integer;
Total, Avg: Double;
begin
Pdf1.PageNumber := 1;
Total := 0;
for I := 0 to Pdf1.CharacterCount - 1 do
Total := Total + Pdf1.FontSize[I];
if Pdf1.CharacterCount > 0 then
begin
Avg := Total / Pdf1.CharacterCount;
ShowMessage('Average size on page 1: ' + FormatFloat('0.00', Avg) + ' pt');
end;
end;