Skip to main content
GameDev.net gamedev.net
🔒 Locked

Finding the string width

Started by Paul H May 22, 2009 at 12:52 PM 0 replies 550+ views
Original Post
Paul H
Paul H
Hey, I have been trying to find the width of every alphabet in diffrent fonts since this is needed for my Editbox control. I have been quite unable to find any relevant info on the net, most of the stuff is about some MeasureString function in gdi and since I have never used gdi I before I would prefer to use a simpler approach using any directx function or something. Basically I am looking for a fnction that would return the correct width of for ex "This is a string", the font I am using is a fairly simple one all alphabets have a width of 6, but this doesnt work for "I" for ex, I could add a check that will return a different width for "I" but I would really prefer a more general approach. I hope any of you have some idea on how to do this. Thank You
SiCrane
SiCrane
Did you try using ID3DXFont::DrawText() with DT_CALCRECT?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.