ID2D1DeviceContext4::DrawText(constWCHAR*,UINT32,IDWriteTextFormat*,constD2D1_RECT_F*,ID2D1Brush*,ID2D1SvgGlyphStyle*,UINT32,D2D1_DRAW_TEXT_OPTIONS,DWRITE_MEASURING_MODE) method (d2d1_3.h)

Draws the text within the given layout rectangle.

By default, this method performs baseline snapping and renders color versions of glyphs in color fonts.

Syntax

void DrawText(
  [in]           const WCHAR            *string,
                 UINT32                 stringLength,
  [in]           IDWriteTextFormat      *textFormat,
  [in]           const D2D1_RECT_F      *layoutRect,
  [in, optional] ID2D1Brush             *defaultFillBrush,
  [in, optional] ID2D1SvgGlyphStyle     *svgGlyphStyle,
                 UINT32                 colorPaletteIndex,
                 D2D1_DRAW_TEXT_OPTIONS options,
                 DWRITE_MEASURING_MODE  measuringMode
);

Parameters

[in] string

Type: const WCHAR*

A pointer to an array of Unicode characters to draw.

stringLength

Type: UINT32

The number of characters in string.

[in] textFormat

Type: IDWriteTextFormat*

An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.

[in] layoutRect

Type: const D2D1_RECT_F*

The size and position of the area in which the text is drawn.

[in, optional] defaultFillBrush

Type: ID2D1Brush*

The brush used to paint the text.

[in, optional] svgGlyphStyle

Type: ID2D1SvgGlyphStyle*

Values for context-fill, context-stroke, and context-value that are used when rendering SVG glyphs.

colorPaletteIndex

Type: UINT32

The index used to select a color palette within a color font.

options

Type: D2D1_DRAW_TEXT_OPTIONS

A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is D2D1_DRAW_TEXT_OPTIONS_NONE, which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle.

measuringMode

Type: DWRITE_MEASURING_MODE

A value that indicates how glyph metrics are used to measure text when it is formatted. The default value is DWRITE_MEASURING_MODE_NATURAL.

Return value

None

Requirements

Requirement Value
Target Platform Windows
Header d2d1_3.h
DLL D2d1.dll

See also

ID2D1DeviceContext4