Calculating Text width in pixel using D3DXFont

Started by
0 comments, last by Evil Steve 17 years, 1 month ago
How do i calculate the exact width and height of the text to be rendered by D3DXFont::DrawText() I think i need to use the D3DXFont::GetGlyphData() but not sure how
Z
Advertisement
From the DX docs for ID3DXFont::DrawText:
Quote:
Format
[in] Specifies the method of formatting the text. It can be any combination of the following values:
...
DT_CALCRECT
Determines the width and height of the rectangle. If there are multiple lines of text, ID3DXFont::DrawText uses the width of the rectangle pointed to by the pRect parameter and extends the base of the rectangle to bound the last line of text. If there is only one line of text, ID3DXFont::DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, ID3DXFont::DrawText returns the height of the formatted text but does not draw the text.

This topic is closed to new replies.

Advertisement