PDFium Component Docs

FontSize Egenskap

Denna API-post behåller identifierare, signaturer, kodblock och PDF-termer i ursprunglig form.
Komponent: TPdf  ·  Enhet: PDFium
Returnerar den renderade teckenstorleken, i PDF-punkter, för ett enskilt tecken på den aktuella sidan. FontSize is an alias for CharacterFontSize retained for backward compatibility.

Syntax

property FontSize[Index: Integer]: Double; // read only

Beskrivning

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.

Indexet är tecknets 0-baserade position i den aktuella sidans textsida, i samma ordning som returneras av 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.

Olika textavsnitt på samma sida kan ha olika storlekar, även inom en enda rad, så storleken måste frågas per tecken snarare än per sida. Observera att denna storlek inte har något samband med måtten som returneras av FontAscent / FontDescent, which describe the font itself; FontSize describes how a specific glyph instance is sized.

Parametrar

Index0-baserat teckenindex på den aktuella sidan, i intervallet 0..CharacterCount - 1.

Anmärkningar

Exempel

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;

Se även

CharacterFontSize, FontWeight, FontFamilyName, CharacterCount, Character