API referenceFonts

fntGlyfOutline

Extract a glyph's contour outline directly from raw TrueType

CategoryStandalone TrueType parsing
Notedocument-independent

Purpose — Extract a glyph's contour outline directly from raw TrueType font bytes, by glyph ID.

Description — Parses the font's glyf table for glyph GID, filling caller-supplied PX/PY/ContEnds arrays up to MaxPts/MaxContours capacity (extra points/contours beyond capacity are silently dropped, not an error — check NumPts/NumContours against your buffer sizes if you need to detect truncation). Also returns UnitsPerEm, AdvW (advance width), and the glyph's bounding box (XMin/YMin/XMax/YMax), all in font design units (not scaled to any point size).

Declarations

C
BOOL32 __stdcall fntGlyfOutline(uint8_t* pTTF, uint32_t Len, uint32_t GID, int32_t MaxPts, int32_t MaxContours, float* PX, float* PY, int32_t* ContEnds, int32_t* NumPts, int32_t* NumContours, int32_t* UnitsPerEm, int32_t* AdvW, int32_t* XMin, int32_t* YMin, int32_t* XMax, int32_t* YMax);
Delphi
function fntGlyfOutline(pTTF: PByte; Len, GID: Cardinal; MaxPts, MaxContours: Integer; PX, PY: PSingle; ContEnds: PInteger; out NumPts, NumContours, UnitsPerEm, AdvW, XMin, YMin, XMax, YMax: Integer): LongBool; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
pTTFPByteRaw TrueType font bytes.
LenCardinalByte length.
GIDCardinalGlyph ID to extract (use fntCmapGID to resolve a Unicode code point to a GID first).
MaxPts, MaxContoursIntegerCapacity of the PX/PY/ContEnds output arrays.
PX, PYPSingleReceive point coordinates, in font design units. May be NULL to skip writing points (e.g. if you only want the bounding box/advance).
ContEndsPIntegerReceives, per contour, the index of its last point in PX/PY. May be NULL.
NumPts, NumContoursInteger*Receive the actual counts (may exceed capacity if truncated — see Description).
UnitsPerEm, AdvW, XMin, YMin, XMax, YMaxInteger*Receive font metrics/bbox for this glyph, in design units.

Return valueTRUE on success; FALSE if pTTF is NULL/empty or GID doesn't resolve to a glyph with contour data (e.g. a composite/empty glyph may not be supported by this extractor — check the source's GlyfOutline helper if you need composite-glyph decomposition guarantees).

See alsofntCmapGID

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
[return: MarshalAs(UnmanagedType.Bool)]
Area
Fonts
Category

Font Services

Exported names

fntGlyfOutline

String variants

The …A form takes UTF-8, …W takes UTF-16; a bare name aliases the ANSI form.

See working code

Worked examples — complete programs in ten languages.