Loading a font

Started by
5 comments, last by Dave Hunt 18 years, 4 months ago
Hello, I want to load a font situed in a directory called 'data/'. the D3DXCreateFont function requires a font name, not a path. How can I do to load a font from a specific directory? Thanks in advance.
Advertisement
Have a look at AddFontResource. It allows you to add a font file in any location to the system font table. Then, D3DXCreateFont will be able to find it by font name.
Thanks a lot for your answer!
Bad news :(

When I use the function, my app crashes.

AddFontResource("data/AgencyB.TTF");

Any idea?
Define "crashes". Also make sure AddFontResource succeeds
The application freezes or simple quits when I call AddFontResource() which is documented to return an integer but when I want to check it I receive the compilator message 'void value not ignored as it ought to be'. Apparently, it returns nothing...
The prototype in WinGDI.h definitely shows this function as returning an int. So, if you're compiler says it returns void, then you've got something wacked with your installation.

What compiler are you using?

This topic is closed to new replies.

Advertisement