IDWriteFactory2::TranslateColorGlyphRun method (dwrite_2.h)

This method is called on a glyph run to translate it in to multiple color glyph runs.

Syntax

HRESULT TranslateColorGlyphRun(
                 FLOAT                              baselineOriginX,
                 FLOAT                              baselineOriginY,
  [in]           DWRITE_GLYPH_RUN const             *glyphRun,
  [in, optional] DWRITE_GLYPH_RUN_DESCRIPTION const *glyphRunDescription,
                 DWRITE_MEASURING_MODE              measuringMode,
  [in, optional] DWRITE_MATRIX const                *worldToDeviceTransform,
                 UINT32                             colorPaletteIndex,
  [out]          IDWriteColorGlyphRunEnumerator     **colorLayers
);

Parameters

baselineOriginX

Type: FLOAT

The horizontal baseline origin of the original glyph run.

baselineOriginY

Type: FLOAT

The vertical baseline origin of the original glyph run.

[in] glyphRun

Type: const DWRITE_GLYPH_RUN*

Original glyph run containing monochrome glyph IDs.

[in, optional] glyphRunDescription

Type: const DWRITE_GLYPH_RUN_DESCRIPTION*

Optional glyph run description.

measuringMode

Type: DWRITE_MEASURING_MODE

Measuring mode used to compute glyph positions if the run contains color glyphs.

[in, optional] worldToDeviceTransform

Type: const DWRITE_MATRIX*

World transform multiplied by any DPI scaling. This is needed to compute glyph positions if the run contains color glyphs and the measuring mode is not DWRITE_MEASURING_MODE_NATURAL. If this parameter is NULL, and identity transform is assumed.

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: IDWriteColorGlyphRunEnumerator**

If the original glyph run contains color glyphs, this parameter receives a pointer to an IDWriteColorGlyphRunEnumerator interface. The client uses the returned interface to get information about glyph runs and associated colors to render instead of the original glyph run. If the original glyph run does not contain color glyphs, this method returns DWRITE_E_NOCOLOR and the output pointer is NULL.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

If the code calls this method with a glyph run that contains no color information, the method returns DWRITE_E_NOCOLOR to let the application know that it can just draw the original glyph run. If the glyph run contains color information, the function returns an object that can be enumerated through to expose runs and associated colors. The application then calls DrawGlyphRun with each of the returned glyph runs and foreground colors.

Requirements

Requirement Value
Minimum supported client Windows 8.1 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 R2 [desktop apps | UWP apps]
Target Platform Windows
Header dwrite_2.h
Library Dwrite.lib
DLL Dwrite.dll

See also

IDWriteFactory2