Windows Dev Center

The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

GetGlyphIndices function

The GetGlyphIndices function translates a string into an array of glyph indices. The function can be used to determine whether a glyph exists in a font.


DWORD GetGlyphIndices(
  _In_   HDC     hdc,
  _In_   LPCTSTR lpstr,
  _In_   int     c,
  _Out_  LPWORD  pgi,
  _In_   DWORD   fl


hdc [in]

A handle to the device context.

lpstr [in]

A pointer to the string to be converted.

c [in]

The length of both the length of the string pointed to by lpstr and the size (in WORDs) of the buffer pointed to by pgi.

pgi [out]

This buffer must be of dimension c. On successful return, contains an array of glyph indices corresponding to the characters in the string.

fl [in]

Specifies how glyphs should be handled if they are not supported. This parameter can be the following value.


Marks unsupported glyphs with the hexadecimal value 0xffff.


Return value

If the function succeeds, it returns the number of bytes (for the ANSI function) or WORDs (for the Unicode function) converted.

If the function fails, the return value is GDI_ERROR.


This function attempts to identify a single-glyph representation for each character in the string pointed to by lpstr. While this is useful for certain low-level purposes (such as manipulating font files), higher-level applications that wish to map a string to glyphs will typically wish to use the Uniscribe functions.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Wingdi.h (include Windows.h)





Unicode and ANSI names

GetGlyphIndicesW (Unicode) and GetGlyphIndicesA (ANSI)

See also

Fonts and Text Overview
Font and Text Functions



Community Additions

© 2015 Microsoft