I'd like to stick these fonts in the game's folder and load them at
run-time. I know it is possible to load an uninstalled font from a file, I've
seen many demos that do it, but don't know how.
Can anyone point me towards sample code, or at least tell me the function
calls that I have to make?
By the way, I'm using Visual C/C++ 5.0
Thanks,
-Andy Kanakares
Do the following:
1. Create font resource (1 == only visible to your app):
CreateScalableFontResource(1, fontTargetPathAndFileName,
fontSourcePathAndFileName, NULL);
2. Add font created to Windows font table.
AddFontResource(fontTargetPathAndFileName);
(If font is not hidden you should broadcast a WM_FONTCHANGE message to let
other apps know that the font table changed.)
3. Use font.
4. Remove font from font table.
RemoveFontResource(fontTargetPathAndFileName);
(If font is not hidden you should broadcast a WM_FONTCHANGE message to let
other apps know that the font table changed.)
5. Remove temporary file.
_unlink(fontTargetPathAndFileName);
Hope this help.
/Peter