Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How can I load uninstalled fonts?

29 views
Skip to first unread message

AndyKan

unread,
Jan 5, 1998, 3:00:00 AM1/5/98
to

I'm writing an on-line game on Win95/Win32 API platform. This game requires
the use of some special TrueType fonts.

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

Peter Frandsen

unread,
Jan 7, 1998, 3:00:00 AM1/7/98
to

> 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?


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

0 new messages