The baptismal "font"
Hi all,
I''m working with Win98 and directx, and I use windows to dump write text on my directx surface dc.
Works fine, but how can I set it up so that I can use the font I drew myself, without installing it on the user''s system? Is there any way to make a font object out of a font I have stored as a resource-- or, better yet, have on the disc?
I don''t want to have to install the font in order to use it to draw text. Any help?
Yours in slavering anticipation,
Goodlife
-- Goodlife-----------------------------Those whom the gods would destroy, they first drive mad.--DirectX design team official motto
I think AddFontResource() and RemoveFontResource() are the functions you want. They both take one parameter which is a LPCTSTR containing the name of the font file.
Once you have added the font you should be able to use it through the normal win32 functions.
Edited by - Bugdude on 2/23/00 1:35:20 AM
Once you have added the font you should be able to use it through the normal win32 functions.
Edited by - Bugdude on 2/23/00 1:35:20 AM
February 23, 2000 02:38 PM
If we assume you have a fonts directory in your project
directory, this is what you''ll want to do to use a font
called Coprgtb.tff:
//Prepare font:
CreateScalableFontResource(0, "Coprgtb",
"Fonts\\Coprgtb.ttf", NULL);
AddFontResource("Fonts\\Coprgtb.ttf");
//Create font:
hFont = CreateFont(blah, blah, blah...);
//And clean up:
RemoveFontResource("Fonts\\Coprgtb.ttf");
*Sparkle*
directory, this is what you''ll want to do to use a font
called Coprgtb.tff:
//Prepare font:
CreateScalableFontResource(0, "Coprgtb",
"Fonts\\Coprgtb.ttf", NULL);
AddFontResource("Fonts\\Coprgtb.ttf");
//Create font:
hFont = CreateFont(blah, blah, blah...);
//And clean up:
RemoveFontResource("Fonts\\Coprgtb.ttf");
*Sparkle*
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement