Using Custom Fonts Without Registering Them

Started by
5 comments, last by Quinnie 17 years, 11 months ago
For my 3D Engine I needed to render some text to the screen, I got this to work, quite simply actually using the D3DXCreateFont() and DrawText() functions. Great! Because I wanted to be a bit more original I would like to use my own TTF fonts, but before I could use them I would need to register them with Windows. Is there a way to Create a font from a path/filename instead from a FaceName? Also I have another problem. I'm rendering 3 Layers... A Background image, A cursor and the Text... How would I get the rendered text to appear infront of the background image but behind the cursor? The Images are rendered using a textured quad. Thanks in advanced for anything that could help me out...
Advertisement
Quote:Original post by Quinnie
For my 3D Engine I needed to render some text to the screen, I got this to work, quite simply actually using the D3DXCreateFont() and DrawText() functions. Great! Because I wanted to be a bit more original I would like to use my own TTF fonts, but before I could use them I would need to register them with Windows.

Did you try putting the fonts in the same directory as the executable? I thought that you didn't need to register the font if you did that, since it searches the residing directory for fonts first.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
While I have never done this, it would seem the AddFontResourceEx function might help you out.
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
Thanks! The AddFontResourceEx helpt me out!

The only thing I'm wondering about now is how I could draw something over a Text, since somehow all texts are in the front and all other graphics are in the back :S

The last past hours I searched the entire SDK and Internet but I couldn't find anything about rendering Textured Quads infront of Texts. Though I've seen it happening in a lot of games. Somehow it must be possible to show my cursor infront of text rendered using the DirectX DrawText function, right?

Thanks in advance.
Quote:Original post by Quinnie
The last past hours I searched the entire SDK and Internet but I couldn't find anything about rendering Textured Quads infront of Texts. Though I've seen it happening in a lot of games. Somehow it must be possible to show my cursor infront of text rendered using the DirectX DrawText function, right?

Did you try making the z-value of your cursor vector close to 0? I remember that I had the same problem once, but I solved it by playing around with small Z-values until it worked out.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Seems not to be the most "clean" way to solve it, I'll first try using 3D Text that should hopefully solve my problem.

This topic is closed to new replies.

Advertisement