GetTabbedTextExtent

Version 3.0

Syntax

DWORD GetTabbedTextExtent(hDC,lpString,nCount,nTabPositions,lpnTabStopPositions)

This function computes the width and height of the line of text pointed to by the lpString parameter. If the string contains one or more tab characters, the width of the string is based upon the tab stops specified by the lpnTabStopPositions parameter. The GetTabbed-TextExtent function uses the currently selected font to compute the dimensions of the string. The width and height (in logical units) are computed without considering the current clipping region.

Parameter Type/Description  

hDC HDC Identifies the device context.  
lpString LPSTR Points to a text string.  
nCount int Specifies the number of characters in the text string.  
nTabPositions int Specifies the number of tab-stop positions in the array to which the lpnTabStopPositions points.  
lpnTabStopPositions LPINT Points to an array of integers containing the tab-stop positions in pixels. The tab stops must be sorted in increasing order; back tabs are not allowed.  

Return Value

The return value specifies the dimensions of the string. The height is in the high-order word; the width is in the low-order word.

Comments

Since some devices do not place characters in regular cell arrays (that is, they carry out kerning), the sum of the extents of the characters in a string may not be equal to the extent of the string.

If the nTabPositions parameter is zero and the lpnTabStopPositions parameter is NULL, tabs are expanded to eight average character widths.

If nTabPositions is 1, the tab stops will be separated by the distance specified by the first value in the array to which lpnTabStopPositions points.

If lpnTabStopPositions points to more than a single value, then a tab stop is set for each value in the array, up to the number specified by nTabPositions.