API referenceFonts

pdfGetGlyphIndex

Map a Unicode code point to its glyph ID in the currently

CategoryGlyph introspection
Notecurrent font only, TrueType only (see Remarks)

Purpose — Map a Unicode code point to its glyph ID in the currently active font.

Declarations

C
int32_t __stdcall pdfGetGlyphIndex(PPDF IPDF, uint32_t Index);
Delphi
function pdfGetGlyphIndex(const IPDF: PPDF; Index: Cardinal): Integer; stdcall; external 'LumasPdf.dll';

Parameters

ParameterTypeDescription
IPDFPPDFInstance handle.
IndexCardinalA Unicode code point (despite the parameter name, this is a character code, not a glyph index — the glyph index is what's returned).

Return value — Glyph ID (> 0) if the currently active font is TrueType and has that glyph; 0 if the current font isn't TrueType or the character has no glyph.

Remarks — no font-handle parameter. There is no way to query a glyph index for a font other than whichever one is currently active — switch fonts first via pdfChangeFont if you need a different font's mapping.

See alsopdfGetGlyphOutline

C# (P/Invoke)

wrappers/dotnet/LumasPdf.cs
public static extern int pdfGetGlyphIndex(IntPtr IPDF, uint Index);
Area
Fonts
Category

Getters

Exported names

pdfGetGlyphIndex

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.