From: dblock on
Hi,

I am working on http://resourcelib.codeplex.com - I wrote r/w support
for just about everything (RT_VERSION, RT_CURSOR, RT_ICON, RT_BITMAP,
RT_DIALOG, RT_MANIFEST, etc.), but I am struggling with RT_FONT and
RT_FONTDIR.

- I can rename a .fon into an .exe and copy-paste a FontDir into a PE
executable, that loads and the structure of FontDir is one of
FONTDIRENTRY as documented in MSDN, oddly padded with zeroes to 512
bytes (why?)?
- I can build a C++ executable with VS 2005 with FONT entries in .rc,
but that seems to embed a FontDir table that has a different format
(FON files as is?).
- I cannot load a .fon with LoadLibrary(Ex), this is not a PE
executable. Is there still a way to invoke LoadLibrary16 from C# these
days?

Anyone can sched some light on some/all of these problems? I don't
think it's that useful actually, but I hate leaving things half
done :)

Thx
dB.
From: Jaelani on
dblock wrote:
> Hi,
>
> I am working on http://resourcelib.codeplex.com - I wrote r/w support
> for just about everything (RT_VERSION, RT_CURSOR, RT_ICON, RT_BITMAP,
> RT_DIALOG, RT_MANIFEST, etc.), but I am struggling with RT_FONT and
> RT_FONTDIR.
>
> - I can rename a .fon into an .exe and copy-paste a FontDir into a PE
> executable, that loads and the structure of FontDir is one of
> FONTDIRENTRY as documented in MSDN, oddly padded with zeroes to 512
> bytes (why?)?
> - I can build a C++ executable with VS 2005 with FONT entries in .rc,
> but that seems to embed a FontDir table that has a different format
> (FON files as is?).
> - I cannot load a .fon with LoadLibrary(Ex), this is not a PE
> executable. Is there still a way to invoke LoadLibrary16 from C# these
> days?
>
> Anyone can sched some light on some/all of these problems? I don't
> think it's that useful actually, but I hate leaving things half
> done :)
>
> Thx
> dB.

FON files are 16-bit modules and they use NE header instead of PE. It's
available since Windows 3.0 (or maybe v2.0). FON files must be 16-bit
modules. 32-bit based FON files won't work.

Borland's Resource Workshop (BRW) is the only resource editor that can
create+edit that legacy resource type, AFAIK. BRW is a 16-bit Windows
application.

Since FON files are 16-bit modules, they can't be loaded using
LoadLibrary function from a 32/64-bit application. If you only need to
access the resource, use resource functions. Otherwise it must be loaded
by a 16-bit application.

Other means to use FON files is to use font functions in order to use
them much like TTF (TrueType Font) files - that is, as fonts.