typedef struct tagFONTINFO {
short dfType;
short dfPoints;
short dfVertRes;
short dfHorizRes;
short dfAscent;
short dfInternalLeading;
short dfExternalLeading;
BYTE dfItalic;
BYTE dfUnderline;
BYTE dfStrikeOut;
short dfWeight;
BYTE dfCharSet;
short dfPixWidth;
short dfPixHeight;
BYTE dfPitchAndFamily;
short dfAvgWidth;
short dfMaxWidth;
BYTE dfFirstChar;
BYTE dfLastChar;
BYTE dfDefaultChar;
BYTE dfBreakChar;
short dfWidthBytes;
unsigned long dfDevice;
unsigned long dfFace;
unsigned long dfBitsPointer;
unsigned long dfBitsOffset;
BYTE dfReserved;
long dfFlags; // Windows 3.x fonts only
short dfAspace; // Windows 3.x fonts only
short dfBspace; // Windows 3.x fonts only
short dfCspace; // Windows 3.x fonts only
long dfReserved; // reserved; do not use.
long dfReserved1[4]; // reserved; do not use.
} FONTINFO;
Contains information about a physical font. Depending on whether the font is realized by GDI or by a device driver, the FONTINFO structure may be immediately followed by a character-width table and by font bitmap or vector information.
The FONTINFO structure contains optional members (dfFlags through dfReserved1) that are present only if the font has been designed for Windows versions 3.x. If GDI realizes a font for a driver, the font's corresponding FONTINFO structure will not include these optional members unless the RC_BIGFONT bit is set in the dpRaster member of the driver's GDIINFO structure.
PF_RASTER_TYPE (0x0000) | Font is a raster font. |
PF_VECTOR_TYPE (0x0001) | Font is a vector font. |
PF_BITS_IS_ADDRESS (0x0004) | The dfBitsOffset member specifies the absolute memory address of the font bitmap or vector information. |
PF_DEVICE_REALIZED (0x0080) | Font has been realized by the device driver. |
PF_GLYPH_INDEX (0x0020h) | Font is a large (two bytes) character set font. |
All other values in the low-order byte are reserved. In particular, the value 0x0008 in the dfType member is reserved for use with Asian fonts.
The high-order byte is reserved for device use. GDI never inspects the high byte. If GDI realizes the font, it sets this byte to zero. If the device driver realizes the font, it can set this byte to any value.
0 | ANSI character set |
2 | Symbol character set |
255 | OEM hardware font |
Character set values that support international versions of the operating system are also permitted.
For vector fonts, the dfPixWidth member is the width of the grid on which the font was digitized.
For raster fonts, dfPixWidth is the width, in pixels, of each character bitmap. If that member is zero, the font has variable-width characters and these widths are specified in the character-width table immediately following this structure.
For vector fonts, the dfPixHeight member is the height of the grid on which the font was digitized.
For raster fonts, dfPixHeight is the height, in scan lines, of each character bitmap.
The dfPitchAndFamily member can be a combination of these values:
0x01 | Variable-pitch font. If this value is not given, the font is fixed pitch. |
FF_ROMAN (0x10) | Proportionally spaced fonts with serifs. |
FF_SWISS (0x20) | Proportionally spaced fonts without serifs. |
FF_MODERN (0x30) | Fixed-pitch fonts. |
FF_SCRIPT (0x40) | Cursive or script fonts. |
FF_DECORATIVE (0x50) | Novelty fonts. |
If the high-order 4 bits are set to FF_DONTCARE (0x00), the font does not belong to a specific family.
If the PF_BITS_IS_ADDRESS bit is set in dfType, dfBitsOffset is an absolute address of the bitmap or vector information. For example, this bit is set if the font bitmap or vector information is in ROM.
For raster fonts, dfBitsOffset points to a sequence of bytes that make up the bitmaps for each character in the font.
For vector fonts, dfBitsOffset points to a string of bytes or words (depending on the size of the grid on which the font was digitized) that specifies the strokes for each character of the font. The dfBitsOffset member must be even.
FSF_FIXED (0x0001) | Font is fixed pitch. |
FSF_PROPORTIONAL (0x0002) | Font is proportional pitch |
FSF_ABCFIXED (0x0004) | Font is an ABC fixed font. The advance width for each character in the font is the sum of the dfAspace, dfBspace, and dfCspace members. |
FSF_ABCPROPORTIONAL (0x0008) | Font is an ABC proportional font. |
This member is present only for Windows 3.x fonts.
The FONTINFO structure may be immediately followed by one or more of the following items:
Item | Description |
---|---|
Character-width table | Specifies the widths of each character as well as specifies the offset to the corresponding bitmap or vector information. |
Bitmaps | Specifies the bits defining the shape of the characters in a raster font. The size of this item is whatever length the total bitmaps occupy. Each row of a raster bitmap must start on a 16-bit boundary, which means that the end of each row must be padded to an even length. |
Vectors | Specifies the set of coordinates that define the shape of the characters in a vector font. |
Font name | Specifies a null-terminated ASCII character string that identifies the name of the font. The size of this field is the length of the string plus a terminating null character. |
Device name | Specifies a null-terminated ASCII character string that specifies the name of the device if this font file is for a specific device. The size of this field is the length of the string plus a terminating null character. |
All device drivers must support Windows 2.x fonts. If a device driver supports Windows 3.x fonts, it must set the RC_BIGFONT bit in the dpRaster member of its GDIINFO structure. Printer drivers can call the GetDeviceCaps function (GDI.80), and check for the RC_BIGFONT bit in the raster capabilities to determine whether the display driver uses Windows 3.x fonts.
When a device driver realizes a font by using the RealizeObject function, the dfFace and dfDevice members must point to valid character strings that contains the font and device names. Windows 2.x Fonts
For Windows 2.x fonts, the character-width table is either an array of integer values or an array of glyph-entry structures. The number of elements in the array is equal to:
dfLastChar - dfFirstChar + 2
That is, there is always one more element than the number of characters in the font. The extra entry is available for storing the size, in bytes, of the last character in a vector font. Although this extra entry applies only to vector fonts, it is present for all fonts.
For fixed-pitch vector fonts, the character-width table is an array of integer values. In this case, each element of the array is an offset (relative to the start of the segment that contains the FONTINFO structure) to the first byte or 16 bits of vector information for the given character. The number of bytes or words for a particular character is calculated by subtracting its character-width table entry from the entry for the next character.
For variable-pitch vector fonts, the character width table is an array of VECTORGLYPHENTRY structures. The VECTORGLYPHENTRY structure has the following form:
typedef struct tagVECTORGLYPHENTRY {
short vgeOffset; // offset to vectors relative to segment start
short vgeWidth; // width of character in pixels
} VECTORGLYPHENTRY;
The vgeOffset member specifies the offset (relative to the start of the segment that contains the FONTINFO structure) to the first byte or 16 bits of vector information for the given character. The vgeWidth member specifies the width for the character.
For raster fonts, the character-width table is an array of RASTERGLYPHENTRY structures.
The rgeWidth member specifies the width, in pixels, of the bitmap for the given character. The member also specifies the advance width for the given character. The rgeOffset member specifies the offset (relative to the start of the segment that contains the FONTINFO structure) to the first byte of bitmap information for the character.
Windows 2.x fonts cannot exceed 64K. Windows 3.x Fonts
Windows 3.x fonts are primarily designed for use on systems with sufficient memory and a microprocessor (such as an 80386) that has instructions using 32-bit address offsets.
For Windows 3.x fonts, the format of the character-width table is dependent on the value of the dfFlags member.
Value | Meaning |
---|---|
DFF_FIXED | Array of RASTERGLYPHENTRY structures. |
DFF_PROPORTIONAL | Array of RASTERGLYPHENTRY structures. |
DFF_ABCFIXED | Array of ABCGLYPHENTRY structures. |
DFF_ABCPROPORTIONAL | Array of ABCGLYPHENTRY structures. |
Windows presently supports only the DFF_FIXED and DFF_PROPORTIONAL values.
The rgeWidth member of the VECTORGLYPHENTRY structure specifies the width, in pixels, of the bitmap for the given character. The member also specifies the width for the character. The rgeOffset member specifies the offset (relative to the start of the segment that contains the FONTINFO structure) to the first byte of bitmap information for the character.
The ABCGLYPHENTRY structure has the following form:
typedef struct tagABCGLYPHENTRY {
short ageWidth; // width of character bitmap, in pixels
long ageOffset; // pointer to the bits
FIXED ageAspace; // A space, in fractional pixels (16.16)
FIXED ageBspace; // B space, in fractional pixels (16.16)
FIXED ageCspace; // C space, in fractional pixels (16.16)
} ABCGLYPHENTRY;
The ageWidth member specifies the width, in pixels, of the bitmap for the given character. The ageOffset member specifies the offset (relative to the start of the segment that contains the FONTINFO structure) to the first byte of bitmap information for the character. The sum of the ageAspace, ageBspace, and ageCspace members specify the width of the character.
Windows 3.x fonts can exceed 64K.
GDIINFO