Ramilol
Ramilol

Reputation: 3462

how to find width of font?

I'm using directx to draw my string, directx uses GDI to draw the string..
I'm using DrawText to draw my string. I need a way to find the width of the string.
Any idea ?

Upvotes: 2

Views: 1479

Answers (2)

GolezTrol
GolezTrol

Reputation: 116190

You mean this DrawText? If so, it has a DT_CALCRECT flag that allows you to calculate the size of the text to draw.

Upvotes: 5

Leo Davidson
Leo Davidson

Reputation: 6153

DrawText can calculate it for you. See the DT_CALCRECT flag:

http://msdn.microsoft.com/en-us/library/dd162498%28v=vs.85%29.aspx

Upvotes: 3

Related Questions