Jump to content
  • Advertisement
Sign in to follow this  
kag1

ID3DXFont Help

This topic is 4880 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!