IDWriteFactory2::TranslateColorGlyphRun method

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]           const DWRITE_GLYPH_RUN               *glyphRun,
  [in, optional] const DWRITE_GLYPH_RUN_DESCRIPTION   *glyphRunDescription,
                       DWRITE_MEASURING_MODE          measuringMode,
  [in, optional] const DWRITE_MATRIX                  *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.

glyphRun [in]

Type: const DWRITE_GLYPH_RUN*

Original glyph run containing monochrome glyph IDs.

glyphRunDescription [in, optional]

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.

worldToDeviceTransform [in, optional]

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.

colorLayers [out]

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

Minimum supported client

Windows 8.1 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 R2 [desktop apps | Windows Store apps]

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Library

Dwrite.lib

DLL

Dwrite.dll

See also

IDWriteFactory2

 

 

Show: