Export (0) Print
Expand All
Expand Minimize

ID2D1RenderTarget::DrawTextLayout method

Draws the formatted text described by the specified IDWriteTextLayout object.

Syntax


virtual void DrawTextLayout(
  D2D1_POINT_2F origin,
  [in]  IDWriteTextLayout *textLayout,
  [in]  ID2D1Brush *defaultForegroundBrush,
  D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE
) = 0;

Parameters

origin

Type: D2D1_POINT_2F

The point, described in device-independent pixels, at which the upper-left corner of the text described by textLayout is drawn.

textLayout [in]

Type: IDWriteTextLayout*

The formatted text to draw. Any drawing effects that do not inherit from ID2D1Resource are ignored. If there are drawing effects that inherit from ID2D1Resource that are not brushes, this method fails and the render target is put in an error state.

defaultForegroundBrush [in]

Type: ID2D1Brush*

The brush used to paint any text in textLayout that does not already have a brush associated with it as a drawing effect (specified by the IDWriteTextLayout::SetDrawingEffect method).

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.

Return value

This method does not return a value.

Remarks

When drawing the same text repeatedly, using the DrawTextLayout method is more efficient than using the DrawText method because the text doesn't need to be formatted and the layout processed with each call.

This method doesn't return an error code if it fails. To determine whether a drawing operation (such as DrawTextLayout) failed, check the result returned by the ID2D1RenderTarget::EndDraw or ID2D1RenderTarget::Flush methods.

Requirements

Minimum supported client

Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | Windows Store apps]

Minimum supported phone

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

Header

D2d1.h

Library

D2d1.lib

DLL

D2d1.dll

See also

ID2D1RenderTarget
Text Formatting and Layout

 

 

Community Additions

ADD
Show:
© 2014 Microsoft