Sign in to follow this  
P3D-BrandonR

DX Font Character Spacing ...

Recommended Posts

P3D-BrandonR    122
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();
g_pFont->GetTextMetricsA(&tm);

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this