FONT Resource Problemo! 
Author Message
 FONT Resource Problemo!

Hello,

I have a VC++ MDI Windows application with something like the following
line in the .RC file...

FONT_EXAMPLE_ID   FONT   "res\\example.fnt"

...where FONT_EXAMPLE_ID is defined in the Resource.h file.

When I compile the code program the font seems to be contained within
the resulting exe but how can I load and use this font without using
AddFontResource() and RemoveFontResource() on the original font file?

Many thanks in advance!

Richard John Moody



Mon, 25 Apr 2005 20:24:27 GMT  
 FONT Resource Problemo!
I don't believe you can. I tried to do exactly the same and couldn't find a
solution. I gave up in the end and used AddFontResource()

I tried the following but it didn't seem to work on a .fnt resource:

 HRSRC hFont = FindResource(NULL, MAKEINTRESOURCE(IDF_FONT1), RT_FONT);
 if (hFont)
 {
  DWORD dwSize = SizeofResource(NULL, hFont);
  HGLOBAL hGlobal = LoadResource(NULL, hFont);
  if (hGlobal)
  {
   LPVOID pFont = LockResource(hGlobal);
   if (pFont)
   {
    HANDLE h = AddFontMemResourceEx(pFont, dwSize, NULL, 0);
   }
  }
 }

Please post any solution you might find :-)



Quote:
> Hello,

> I have a VC++ MDI Windows application with something like the following
> line in the .RC file...

> FONT_EXAMPLE_ID   FONT   "res\\example.fnt"

> ...where FONT_EXAMPLE_ID is defined in the Resource.h file.

> When I compile the code program the font seems to be contained within
> the resulting exe but how can I load and use this font without using
> AddFontResource() and RemoveFontResource() on the original font file?

> Many thanks in advance!

> Richard John Moody



Wed, 27 Apr 2005 00:31:25 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. fseek() problemo's.

2. pointer problemo

3. HEX to DEC IMAL problemo

4. vc problemo!!

5. GetExitCodeProcess - big problemo!

6. small c++ problemo

7. GetExitCodeProcess - big problemo!

8. Cannot add new resource font at Windows 3.1

9. Loading font from resources

10. Setting default font for a Dialog resource (HELP)

11. Fonts and GDI-resources

12. Multiple colors and font in a resource

 

 
Powered by phpBB® Forum Software