Platform SDK: International Features

ScriptGetCMap

The ScriptGetCMap function takes a string and returns the glyph indices of the Unicode characters according to the TrueType cmap table or the standard cmap table implemented for old style fonts.

HRESULT WINAPI ScriptGetCMap(
  HDC hdc, 
  SCRIPT_CACHE *psc, 
  const WCHAR *pwcInChars, 
  int cChars, 
  DWORD dwFlags, 
  WORD *pwOutGlyphs 
);

Parameters

hdc
[in] Handle to the device context. This parameter is optional.
psc
[in/out] Pointer to a SCRIPT_CACHE structure.
pwcInChars
[in] Pointer to a string of Unicode characters.
cChars
[in] Number of Unicode characters in pwcInChars.
dwFlags
[in] This parameter can be the following value.
Value Meaning
SGCM_RTL Indicates the glyph array pwOutGlyps should contain mirrored glyphs for those glyphs that have a mirrored equivalent.

pwOutGlyphs
[out] Pointer to an array that receives the glyph indices.

Return Values

If all Unicode code points are present in the font, the return value is S_OK.

If the function fails, it may return one of the following nonzero values.

Return value Meaning
E_HANDLE The font or the system does not support glyph indices.
S_FALSE Some of the Unicode code points were mapped to the default glyph.

If any other unrecoverable error is encountered, it is also returned as HRESULT. For example, error returns from Win32 API functions are converted to HRESULT using the HRESULT_FROM_WIN32 macro and returned to the client in the HRESULT.

Remarks

ScriptGetCMap may be used to determine which characters in a run are supported by the selected font. The caller may scan the returned glyph buffer looking for the default glyph to determine which characters are not available. The default glyph index for the selected font should be determined by calling ScriptGetFontProperties.

The return value indicates the presence of any missing glyphs.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Header: Declared in Usp10.h.
  Library: Use Usp10.lib.

See Also

Uniscribe Overview, Uniscribe Functions, ScriptGetFontProperties, SCRIPT_CACHE