GetGlyphIndicesW function (wingdi.h)

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.

Syntax

DWORD GetGlyphIndicesW(
  [in]  HDC     hdc,
  [in]  LPCWSTR lpstr,
  [in]  int     c,
  [out] LPWORD  pgi,
  [in]  DWORD   fl
);

Parameters

[in] hdc

A handle to the device context.

[in] lpstr

A pointer to the string to be converted.

[in] c

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.

[out] pgi

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

[in] fl

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

Value Meaning
GGI_MARK_NONEXISTING_GLYPHS
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.

Remarks

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.

Note

The wingdi.h header defines GetGlyphIndices as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Font and Text Functions

Fonts and Text Overview

GetFontUnicodeRanges