IDWriteFactory8::TranslateColorGlyphRun method (dwrite_3.h)

Translates a glyph run to a sequence of color glyph runs, which can be rendered to produce a color representation of the original "base" run. Adds a new paintFeatureLevel parameter, but is otherwise identical to IDWriteFactory4::TranslateColorGlyphRun.

Syntax

HRESULT TranslateColorGlyphRun(
  D2D1_POINT_2F                      baselineOrigin,
  DWRITE_GLYPH_RUN const             *glyphRun,
  DWRITE_GLYPH_RUN_DESCRIPTION const *glyphRunDescription,
  DWRITE_GLYPH_IMAGE_FORMATS         desiredGlyphImageFormats,
  DWRITE_PAINT_FEATURE_LEVEL         paintFeatureLevel,
  DWRITE_MEASURING_MODE              measuringMode,
  DWRITE_MATRIX const                *worldAndDpiTransform,
  UINT32                             colorPaletteIndex,
  IDWriteColorGlyphRunEnumerator1    **colorEnumerator
);

Parameters

baselineOrigin

Type: D2D1_POINT_2F

Horizontal and vertical origin of the base glyph run in pre-transform coordinates.

glyphRun

Type: _In_ DWRITE_GLYPH_RUN const*

Pointer to the original "base" glyph run.

glyphRunDescription

Type: _In_opt_ DWRITE_GLYPH_RUN_DESCRIPTION const*

Optional glyph run description.

desiredGlyphImageFormats

Type: DWRITE_GLYPH_IMAGE_FORMATS

The data formats that the method should split the runs into.

paintFeatureLevel

Type: DWRITE_PAINT_FEATURE_LEVEL

The paint feature level supported by the caller. Used when desiredGlyphImageFormats includes DWRITE_GLYPH_IMAGE_FORMATS_COLR_PAINT_TREE. For more info, see DWRITE_PAINT_FEATURE_LEVEL.

measuringMode

Type: DWRITE_MEASURING_MODE

The measuring mode, which is needed to compute the origins of each glyph.

worldAndDpiTransform

Type: _In_opt_ DWRITE_MATRIX const*

Matrix converting from the client's coordinate space to device coordinates (pixels)—that is, the world transform multiplied by any DPI scaling.

colorPaletteIndex

Type: UINT32

Zero-based index of the color palette to use. Valid indices are less than the number of palettes in the font, as returned by IDWriteFontFace2::GetColorPaletteCount.

colorEnumerator

Type: _COM_Outptr_ IDWriteColorGlyphRunEnumerator1 **

If the function succeeds, receives a pointer to an enumerator object that can be used to obtain the color glyph runs. If the base run has no color glyphs, then the output pointer is NULL, and the method returns DWRITE_E_NOCOLOR.

Return value

Returns DWRITE_E_NOCOLOR if the font has no color information, or if the glyph run doesn't contain any color glyphs, or if the specified color palette index is out of range. In those cases, the client should render the original glyph run. Otherwise, returns a standard HRESULT error code.

Remarks

Calling IDWriteFactory2::TranslateColorGlyphRun is equivalent to calling IDWriteFactory2::TranslateColorGlyphRun, and passing DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE|CFF|COLR in desiredGlyphImageFormats.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1809 (with Windows App SDK 1.2 or later)
Header dwrite_3.h

See also