IDWriteFontFace1::GetUnicodeRanges method (dwrite_1.h)

Retrieves a list of character ranges supported by a font.

Syntax

HRESULT GetUnicodeRanges(
                  UINT32               maxRangeCount,
  [out, optional] DWRITE_UNICODE_RANGE *unicodeRanges,
  [out]           UINT32               *actualRangeCount
);

Parameters

maxRangeCount

Type: UINT32

Maximum number of character ranges passed in from the client.

[out, optional] unicodeRanges

Type: DWRITE_UNICODE_RANGE*

An array of DWRITE_UNICODE_RANGE structures that are filled with the character ranges.

[out] actualRangeCount

Type: UINT32*

A pointer to the actual number of character ranges, regardless of the maximum count.

Return value

Type: HRESULT

This method can return one of these values.

Return value Description
S_OK
The method executed successfully.
E_NOT_SUFFICIENT_BUFFER
The buffer is too small. The actualRangeCount was more than the maxRangeCount.

Remarks

A list of character ranges supported by the font is useful for scenarios like character picking, glyph display, and efficient font selection lookup. This is similar to GDI's GetFontUnicodeRanges, except that it returns the full Unicode range, not just 16-bit UCS-2.

These ranges are from the cmap, not the OS/2::ulCodePageRange1.

If this method is unavailable, you can use the IDWriteFontFace::GetGlyphIndices method to check for missing glyphs. The method returns the 0 index for glyphs that aren't present in the font.

The IDWriteFont::HasCharacter method is often simpler in cases where you need to check a single character or a series of single characters in succession, such as in font fallback.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header dwrite_1.h
Library Dwrite_1.lib
DLL Dwrite_1.dll

See also

IDWriteFontFace1