Docs de PDFiumPas

FontSize Propiedad

Esta entrada API conserva identificadores, firmas, bloques de código y términos PDF en su forma original.
Componente: TPdf  ·  Unidad: PDFium
Devuelve el tamaño de fuente renderizado, en puntos PDF, de un carácter individual en la página actual FontSize is an alias for CharacterFontSize retained for backward compatibility.

Sintaxis

property FontSize[Index: Integer]: Double; // solo lectura

Descripción

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.

El índice es la posición basada en 0 del carácter en la página de texto de la página actual, en el mismo orden devuelto por 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.

Distintos tramos de texto en la misma página pueden tener tamaños diferentes, incluso dentro de una sola línea, así que el tamaño debe consultarse por carácter y no por página. Ten en cuenta que este tamaño no está relacionado con las métricas devueltas por FontAscent / FontDescent, which describe the font itself; FontSize describes how a specific glyph instance is sized.

Parámetros

Indexíndice de carácter basado en 0 en la página actual, en el rango 0..CharacterCount - 1.

Notas

Ejemplo

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;

Véase también

CharacterFontSize, FontWeight, FontFamilyName, CharacterCount, Character