-
Notifications
You must be signed in to change notification settings - Fork 11
OS 2 bitmap fonts
OS/2 supports various font formats. The native resource is the GPI font, sometimes stored in a file with suffix .fnt
but more often in a dynamic link library file with the suffix .fon
. Note that while this is the same suffix pattern as for Microsoft Windows, both the resource and the library format are very different.
The GPI font resource is based on the FONTMETRICS
internal structure, documented in The OS/2 Presentation Manager (p.100 ff.) and Programming the OS/2 Warp (p.121 ff.).
The source code of the OS/2 GPI Font Tools by Alexander Taylor is very well documented and has everything needed to decode the format.
- Like Windows
.fon
files, the OS/2 version is a library of resources contained in an executable file. - However, the OS/2 native executable format is the
LX
Linear Executable - Older OS/2 files may be
NE
New Executables which is the same 16-bit executable format as Windows uses for.fon
files. However, the resource table is structured differently and this format is very sparsely and poorly documented. See summary below.
A narrative description is given in Resources and Decompiling Them by Martin Lafaix.
The Microsoft OS/2 documentation actually describes the same format as used by Windows. However, this is not what is used by OS/2 in practice. The OS/2 format is described in the ancient and hard to find KB59916, which acknowledges the conflicting definitions:
The definition of the resource table section of the executable header for OS/2 is not correct in either the documentation or the NEWEXE.H file that is supplied with some of the programming toolkits.
The correct definition of the resource table section of the executable header is listed below.
The key section, reformatted:
The resource table itself is an array of 4-byte structures defined as follows:
struct {
ushort rt_id; /* Type of resource (MENU, DIALOG, POINTER, and so on.) */
ushort rt_name; /* ID of resource from .RC file */
};
The resource entries in the segment table are defined using the
new_seg
structure as follows:
struct new_seg /* New .EXE segment table entry */ {
unsigned short ns_sector; /* File sector of start of segment */
unsigned short ns_cbseg; /* Number of bytes in file */
unsigned short ns_flags; /* Attribute flags */
unsigned short ns_minalloc; /* Minimum allocation in bytes */
};
See NEWEXE.H, which is available in the OS/2 version 1.0 Programmer’s Toolkit and also available in the Software/Data Library, for details on the segment table fields.
The NE
header structure is given at INT21.
OS/2 may also use the LE
format, which is substantially similar and perhaps compatible with LX
. It's also used by some DOS extenders and certain Windows device drivers. More information on LX
and LE
at: