Windows Dev Center

IDWriteTextLayout::Draw method

Draws text using the specified client drawing context.

Syntax


virtual HRESULT Draw(
   void                * clientDrawingContext,
   IDWriteTextRenderer * renderer,
   FLOAT                originX,
   FLOAT                originY
) = 0;

Parameters

clientDrawingContext

Type: void*

An application-defined drawing context.

renderer

Type: IDWriteTextRenderer*

Pointer to the set of callback functions used to draw parts of a text string.

originX

Type: FLOAT

The x-coordinate of the layout's left side.

originY

Type: FLOAT

The y-coordinate of the layout's top side.

Return value

Type: HRESULT

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

Remarks

To draw text with this method, a textLayout object needs to be created by the application using IDWriteFactory::CreateTextLayout.

After the textLayout object is obtained, the application calls the IDWriteTextLayout::Draw method to draw the text, decorations, and inline objects. The actual drawing is done through the callback interface passed in as the textRenderer argument; there, the corresponding DrawGlyphRun API is called.

If you set a vertical text reading direction on IDWriteTextLayout via SetReadingDirection with DWRITE_READING_DIRECTION_TOP_TO_BOTTOM (or bottom to top), then you must pass an interface that implements IDWriteTextRenderer1. Otherwise you get the error DWRITE_E_TEXTRENDERERINCOMPATIBLE because the original IDWriteTextRenderer interface only supported horizontal text.

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

Dwrite.h

Library

Dwrite.lib

DLL

Dwrite.dll

See also

IDWriteTextLayout

 

 

Community Additions

ADD
Show:
© 2015 Microsoft