IDWriteFactory4::TranslateColorGlyphRun method

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,
  DWRITE_GLYPH_RUN const             *glyphRun,
  DWRITE_GLYPH_RUN_DESCRIPTION const *glyphRunDescription,
  DWRITE_GLYPH_IMAGE_FORMATS         desiredGlyphImageFormats,
  DWRITE_MEASURING_MODE              measuringMode,
  DWRITE_MATRIX const                *worldAndDpiTransform,
  UINT32                             colorPaletteIndex,
  IDWriteColorGlyphRunEnumerator1    **colorLayers
);

Parameters

baselineOrigin

Type: D2D1_POINT_2F

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

glyphRun

Type: DWRITE_GLYPH_RUN

Pointer to the original "base" glyph run.

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.

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.

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

   
Target Platform Windows
Header dwrite_3.h
Library Dwrite.lib

See Also

IDWriteFactory4