IDWriteFactory4::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.

Syntax

HRESULT TranslateColorGlyphRun(
                 D2D1_POINT_2F                      baselineOrigin,
  [in]           DWRITE_GLYPH_RUN const             *glyphRun,
  [in, optional] DWRITE_GLYPH_RUN_DESCRIPTION const *glyphRunDescription,
                 DWRITE_GLYPH_IMAGE_FORMATS         desiredGlyphImageFormats,
                 DWRITE_MEASURING_MODE              measuringMode,
  [in, optional] DWRITE_MATRIX const                *worldAndDpiTransform,
                 UINT32                             colorPaletteIndex,
  [out]          IDWriteColorGlyphRunEnumerator1    **colorLayers
);

Parameters

baselineOrigin

Type: D2D1_POINT_2F

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

[in] glyphRun

Type: DWRITE_GLYPH_RUN

Pointer to the original "base" glyph run.

[in, optional] glyphRunDescription

Type: DWRITE_GLYPH_RUN_DESCRIPTION

Optional glyph run description.

desiredGlyphImageFormats

Type: DWRITE_GLYPH_IMAGE_FORMATS

Which data formats the runs should be split into.

measuringMode

Type: DWRITE_MEASURING_MODE

Measuring mode, needed to compute the origins of each glyph.

[in, optional] worldAndDpiTransform

Type: DWRITE_MATRIX

Matrix converting from the client's coordinate space to device coordinates (pixels), i.e., 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.

[out] colorLayers

Type: 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

Type: HRESULT

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

Remarks

Calling IDWriteFactory2::TranslateColorGlyphRun is equivalent to calling IDWriteFactory4::TranslateColorGlyph run with the following formats specified: DWRITE_GLYPH_IMAGE_FORMATS_TRUETYPE|DWRITE_GLYPH_IMAGE_FORMATS_CFF|DWRITE_GLYPH_IMAGE_FORMATS_COLR.

Requirements

Requirement Value
Target Platform Windows
Header dwrite_3.h
Library Dwrite.lib

See also

IDWriteFactory4