Jump to content
  • Advertisement
Sign in to follow this  

DX Font Character Spacing ...

This topic is 4442 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all, I can't seem to find a definative answer to this topic. Break-down on what I'm doing is I'm using ID3DXFont with DX 9 and attempting to make my own GUI Textbox control. I know I could simply just use the DX common gui control one, but what fun is that ? I like learning how things work so thought I would write all my stuff from scratch. I've got it coming along nicely now, just lacking the part where I need to get the character spacing between each character ID3DXFont draws on screen, so I know the correct spot to stick the Carrot when the control has focus. I have managed to locate some nice examples and howtos, but can't seem to make them work correctly. For example: http://www.geocities.com/foetsch/bmpfonts/bmpfonts.htm That has seemed to help the most. Only problem is it doesn't seem to get the correct font size or (sizes) for that matter that the ID3DXFont is using after creation. So I tried this little trick.
ID3DXFont g_pFont;

//After creation and all then this...
hDC = g_pFont->GetDC();

if (!GetCharABCWidths(hDC, 32, 255, abc))
     ... //Code Continues on
The TextMetrics returned straight from the ID3DXFont object seems to be a little closer than previous attempts, yet still way off. I can't seem to figure out the proper way of dealing with this situation. Am I really going about this the right way ? Anyways, thanks all in advance ! Brandon

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!