PDFium Delphi Component Docs

TextObjectGlyphWidth method

Component: TPdf  ·  Unit: PDFium
Returns the native glyph advance of one text-object glyph at a requested font size

Syntax

function TextObjectGlyphWidth(Index, GlyphIndex: Integer; FontSize: Single): Single;

Description

TextObjectGlyphWidth queries the native text object at Index for the advance width of glyph GlyphIndex, scaled to FontSize in PDF user units

The result is 0 when the index is not a text object, the glyph index is out of range, or the native API is unavailable in the loaded DLL

Remarks

    • Unlike matrix-based approximations, the value comes from the embedded or substituted font program itself
    • Use TextObjectGlyphOutline for path geometry and TextObjectFontSize for the object-level size

Example

W := Pdf1.TextObjectGlyphWidth(ObjIdx, GlyphIdx, 12);

See Also