font metrics with drawText()

Started by
1 comment, last by wizrad 15 years, 9 months ago
Hi, so I'm working on a small GUI project with directx and for some controls such as textboxes I need to know the exact size a string will have when it is displayed. Currently I'm using LPD3DXFONT::drawText() in order to draw text. When I try to get the rectangle the text will display in by passing DT_CALCRECT, the rectangle is pretty inexact. Does anyone know how to get the exact size of displayed text? Thanks
Advertisement
It's been a while since I had to do this, but I don't remember having any problems with GetTextExtentPoint32() so it might be worth giving that a try?

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

thanks I will give it a try


It worked! Thanks this was a big help. I wouldn't have thought of using GDI.

[Edited by - wizrad on July 7, 2008 3:40:40 PM]

This topic is closed to new replies.

Advertisement