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(
  const WCHAR            *string,
  UINT32                 stringLength,
  IDWriteTextFormat      *textFormat,
  const D2D1_RECT_F      *layoutRect,
  ID2D1Brush             *defaultFillBrush,
  ID2D1SvgGlyphStyle     *svgGlyphStyle,
  UINT32                 colorPaletteIndex,
  D2D1_DRAW_TEXT_OPTIONS options,
  DWRITE_MEASURING_MODE  measuringMode
);

Parameters

string

Type: const WCHAR*

A pointer to an array of Unicode characters to draw.

stringLength

Type: UINT32

The number of characters in string.

textFormat

Type: IDWriteTextFormat*

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

layoutRect

Type: const D2D1_RECT_F*

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

defaultFillBrush

Type: ID2D1Brush*

The brush used to paint the text.

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

   
Target Platform Windows
Header d2d1_3.h
DLL D2d1.dll

See also

ID2D1DeviceContext4