GetTextExtentPointI function (wingdi.h)
The GetTextExtentPointI function computes the width and height of the specified array of glyph indices.
Syntax
BOOL GetTextExtentPointI(
[in] HDC hdc,
[in] LPWORD pgiIn,
[in] int cgi,
[out] LPSIZE psize
);
Parameters
[in] hdc
Handle to the device context.
[in] pgiIn
Pointer to array of glyph indices.
[in] cgi
Specifies the number of glyph indices.
[out] psize
Pointer to a SIZE structure that receives the dimensions of the string, in logical units.
Return value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Remarks
The GetTextExtentPointI function uses the currently selected font to compute the dimensions of the array of glyph indices. The width and height, in logical units, are computed without considering any clipping.
When this function returns the text extent, it assumes that the text is horizontal, that is, that the escapement is always 0. This is true for both the horizontal and vertical measurements of the text. Even if you use a font that specifies a nonzero escapement, this function doesn't use the angle while it computes the text extent. The app must convert it explicitly. However, when the graphics mode is set to GM_ADVANCED and the character orientation is 90 degrees from the print orientation, the values that this function return do not follow this rule. When the character orientation and the print orientation match for a given string, this function returns the dimensions of the string in the SIZE structure as { cx : 116, cy : 18 }. When the character orientation and the print orientation are 90 degrees apart for the same string, this function returns the dimensions of the string in the SIZE structure as { cx : 18, cy : 116 }.
Because some devices kern characters, the sum of the extents of the individual glyph indices may not be equal to the extent of the entire array of glyph indices.
The calculated string width takes into account the intercharacter spacing set by the SetTextCharacterExtra function.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | wingdi.h (include Windows.h) |
Library | Gdi32.lib |
DLL | Gdi32.dll |