Sign in to follow this  

ID3DXFont Help

This topic is 4665 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 wish to do is just load a truetype font and maybe set the size and style and use it..but it seems like I almost have to create my own font to use fonts in D3D..Is there a way I can load the dimensions and such from a .ttf file? Thanks for the Help, I would have searched the forums for a question like this before, but the search is disabled..soo..

Share this post


Link to post
Share on other sites
TTF files don't have dimensions, they're designed to be any size you want. You can set the width to 0 if you want to use the default width, and then you can set the height to whatever size you want your font (in pixels).
E.g.

// pDevice is the IDirect3DDevice9*
ID3DXFont* pFont;
const int nHeight = 16;
hResult = D3DXCreateFont(pDevice, nHeight, 0, FW_BOLD, 1, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE, "Ariel", &pFont);
if(FAILED(hResult))
{
// Error
}



Share this post


Link to post
Share on other sites

This topic is 4665 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.

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