Embedding .FON Files in an MS-DOS .EXE FileID: Q89144
|
You can create MS-DOS programs that load fonts from .FON font files. It is
sometimes desirable to embed a font into an MS-DOS .EXE file so that
there are fewer files to distribute with the program. However, it is
not possible to embed the .FON files into .EXE files.
You can create a new font resource file (.FNT) and embed it into the
MS-DOS .EXE file rather than placing it into a .FON file. A Windows
resource compiler such as RC.EXE supplied with the Windows 3.0
Software Development Kit (SDK) or Windows 3.1 SDK needs to be used to
embed a .FNT file into an .EXE file or to create a .FON file.
The purpose of embedding a font into an MS-DOS .EXE file is to have
fewer files to distribute. The _registerfonts() and _setfont()
functions will still read the font information from the .EXE file at
run time. Embedding the font into the executable does not stop these
functions from accessing the disk.
To embed a .FNT file into an MS-DOS executable, do the following:
/* Compile options needed: /link graphics.lib
*/
#include <graph.h>
#include <conio.h>
void main (short argc, char * argv[])
{
_registerfonts (argv[0]);
_setfont ("n1");
_setvideomode (_MAXRESMODE);
_outgtext ("hello");
getch ();
_setvideomode (_DEFAULTMODE);
}
1 FONT FONT.FNT
/* Compile options needed: /c
*/
int junk;
LIBRARY font
EXETYPE WINDOWS
DESCRIPTION 'font'
STUB 'HELLO.EXE'
DATA NONE
LINK FNTHELLO.OBJ, FNTHELLO.EXE, NUL, /NOD, FNTHELLO.DEF
RC FONT.RC FNTHELLO.EXE
- Microsoft Windows Software Development Kit "Guide to Programming" manual for version 3.0
Additional query words: kbinf 6.00 6.00a 6.00ax 7.00 1.00 1.50
Keywords : kb16bitonly
Version :
Platform :
Issue type :
Last Reviewed: July 26, 1999