Archived

This topic is now archived and is closed to further replies.

Psybr

CreateFont()

Recommended Posts

im using the id3dxfont interface to create a font engine, but im not really sure how to use gdi functions like CreateFont(). HFONT hFont = CreateFont( tempHeight, 0, 0, 0, FW_REGULAR, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, ANTIALIASED_QUALITY, VARIABLE_PITCH|FF_DONTCARE, "Century Gothic" ); thats what my function call looks like, and i think the problem may be that i dont understand the "null terminated string" part.

Share this post


Link to post
Share on other sites
No, you shouldn''t need to add the explicit null char at the end of the string. In C/C++, all strings embedded in your program (e.g. "a string") will automatically get a null character added to the end.

The problem may be that the font you requested simply was not available, either by that name, or in that point size. The problem might also be that the font was not available given your request via the parameters OUT_TT_PRECIS (try OUT_DEFAULT_PRECIS) and/or ANTIALIASED_QUALITY (try NONANTIALIASED_QUALITY).

If you want to see which fonts are available, you could enumerate the fonts using EnumFontFamilies - see docs for details.

Share this post


Link to post
Share on other sites