| Category | Standalone TrueType parsing |
|---|---|
| Note | document-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
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);
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
| Parameter | Type | Description |
|---|---|---|
pTTF | PByte | Raw TrueType font bytes. |
Len | Cardinal | Byte length. |
GID | Cardinal | Glyph ID to extract (use fntCmapGID to resolve a Unicode code point to a GID first). |
MaxPts, MaxContours | Integer | Capacity of the PX/PY/ContEnds output arrays. |
PX, PY | PSingle | Receive point coordinates, in font design units. May be NULL to skip writing points (e.g. if you only want the bounding box/advance). |
ContEnds | PInteger | Receives, per contour, the index of its last point in PX/PY. May be NULL. |
NumPts, NumContours | Integer* | Receive the actual counts (may exceed capacity if truncated — see Description). |
UnitsPerEm, AdvW, XMin, YMin, XMax, YMax | Integer* | Receive font metrics/bbox for this glyph, in design units. |
Return value — TRUE 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 also — fntCmapGID
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Font Services
fntGlyfOutline
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.