Export (0) Print
Expand All

IDWriteTextLayout::HitTestTextPosition method

The application calls this function to get the pixel location relative to the top-left of the layout box given the text position and the logical side of the position. This function is normally used as part of caret positioning of text where the caret is drawn at the location corresponding to the current text editing position. It may also be used as a way to programmatically obtain the geometry of a particular text position in UI automation.

Syntax


virtual HRESULT HitTestTextPosition(
  UINT32  textPosition,
  BOOL  isTrailingHit,
  [out]  FLOAT * pointX,
  [out]  FLOAT * pointY,
  [out]  DWRITE_HIT_TEST_METRICS * hitTestMetrics
) = 0;

Parameters

textPosition

Type: UINT32

The text position used to get the pixel location.

isTrailingHit

Type: BOOL

A Boolean flag that indicates whether the pixel location is of the leading or the trailing side of the specified text position.

pointX [out]

Type: FLOAT*

When this method returns, contains the output pixel location X, relative to the top-left location of the layout box.

pointY [out]

Type: FLOAT*

When this method returns, contains the output pixel location Y, relative to the top-left location of the layout box.

hitTestMetrics [out]

Type: DWRITE_HIT_TEST_METRICS*

When this method returns, contains the output geometry fully enclosing the specified text position.

Return value

Type: HRESULT

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

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:
© 2014 Microsoft