Docs de PDFiumPas

FontWeight 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 peso estilo CSS (grosor) de la fuente usada por un objeto de página en la página actual. Los valores típicos son 400 para normal y 700 para negrita

Sintaxis

property FontWeight[Index: Integer]: Integer; // solo lectura

Descripción

FontWeight informa de la clase de peso de la fuente a la que hace referencia el objeto de página en el índice dado, siguiendo la convención CSS / OpenType: 100 (Thin) hasta 900 (Black), con 400 = Regular y 700 = Bold. Se deriva del descriptor de fuente incrustado o, para fuentes no incrustadas, de la tabla de sustitución de PDFium

The index is the 0-based page object index, valid from 0 to ObjectCount - 1. Only text objects carry a meaningful weight; querying a non-text object returns 0. For weights tied to individual extracted characters (rather than to a page object's font dictionary) use CharacterFontWeight.

A page must be active (PageNumber already set). The weight is decoded from the font handle obtained via FontHandle; si la propia fuente no declara un peso, PDFium devuelve 0 y la propiedad hace lo mismo

Parámetros

Index0-based page-object index, in the range 0..ObjectCount - 1. Only text objects produce a non-zero weight.

Notas

Ejemplo

var
  I, BoldCount: Integer;
begin
  Pdf1.PageNumber := 1;
  BoldCount := 0;
  for I := 0 to Pdf1.ObjectCount - 1 do
    if Pdf1.FontWeight[I] >= 600 then
      Inc(BoldCount);
  ShowMessage(IntToStr(BoldCount) + ' bold text objects on page 1');
end;

Véase también

CharacterFontWeight, FontFamilyName, FontItalicAngle, FontHandle, ObjectCount