FONTINFO


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.

dfType

Font type. The low-order byte, reserved for exclusive GDI use, is a combination of these values:

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.

dfPoints

Point size at which the character looks the best.

dfVertRes

Vertical resolution, in DPI, at which this character set was digitized.

dfHorizRes

Horizontal resolution, in DPI, at which this character set was digitized.

dfAscent

Distance from the top of a character definition cell to the baseline of the typographical font. This value is useful for aligning the baseline of fonts of different heights.

dfInternalLeading

Amount of leading inside the bounds set by the dfPixHeight member. Accent marks may occur in this area.

dfExternalLeading

Amount of extra leading that the designer requests the application add between rows. Because this area is outside of the font proper, it contains no marks and will not be altered by text output calls in either the OPAQUE or TRANSPARENT mode.

dfItalic

Italic flag that specifies whether the character-definition data represents an italic font. The low-order bit is 1 if the flag is set. All other bits are zero.

dfUnderline

Underline flag that specified whether the character-definition data represents an underlined font. The low-order bit is 1 if the flag is set. All other bits are zero.

dfStrikeOut

Strikeout flag that specifies whether the character definition data represents a struck-out font. The low-order bit is 1 if the flag is set. All other bits are zero.

dfWeight

Weight of the characters in the character-definition data, on a scale from 1–1000. A value of 400 specifies regular weight type; 700 is bold; and so on.

dfCharSet

Character set defined by this font. Can be one of these values:

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.

dfPixWidth

Width of all characters in the font.

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.

dfPixHeight

Height of all characters in the font.

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.

dfPitchAndFamily

Pitch and font family. The pitch specifies whether the characters in the font have the same width or variable widths. The font family indicates, in a general way, the look of a font.

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.

dfAvgWidth

Width of characters in the font. For fixed-pitch fonts, this value is the same as dfPixWidth. For variable-pitched fonts, this is the width of the uppercase character "X."

dfMaxWidth

Maximum pixel-width of any character in the font. For fixed-pitch fonts, this is simply dfPixWidth.

dfFirstChar

First-character code defined by this font. Character definitions are stored only for the characters actually present in a font, so this member should be used when calculating indices into the character-width table following this structure.

dfLastChar

Last-character code defined by this font. Note that all the characters with codes between the dfFirstChar and dfLastChar member must be present in the character-width table.

dfDefaultChar

Default character. A device driver uses this character as a substitute for any character in a string that is out of the range of the dfFirstChar through dfLastChar members. The character is given relative to dfFirstChar so that the actual value of the default character is the sum of dfDefaultChar and dfFirstChar. Ideally, the dfDefaultChar member should be a visible character in the current font--for example, a period (.).

dfBreakChar

Word-break character. Applications use this character to separate words when wrapping or justifying lines of text. The character is given relative to dfFirstChar so that the actual value of the word-break character is the sum of the dfBreakChar and dfFirstChar members. In many fonts, dfBreakChar is zero and dfFirstChar is 32. This means that the word-break character value is 32, an ASCII space.

dfWidthBytes

Number of bytes in each row of the font bitmap (raster fonts). This field is not used for vector fonts. The dfWidthBytes member is always an even quantity so that rows of the bitmap start on 16-bit boundaries.

dfDevice

Offset from the beginning of the segment that contains the FONTINFO structure to the null-terminated ASCII string that specifies the device name. For a generic font, this value is NULL.

dfFace

Offset from the beginning of the segment that contains the FONTINFO structure to the null-terminated ASCII string that specifies the name of the font face.

dfBitsPointer

Absolute machine address of the bitmap. This member is set by GDI. The dfBitsPointer member is guaranteed to be even.

dfBitsOffset

Offset from the beginning of the segment that contains the FONTINFO structure to the beginning of the bitmap information.

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.

dfReserved

Reserved; do not use. This member is present only for raster fonts. In Windows 2.x fonts, this member ensures that the character-width table (which immediately follows this member) starts on a 16-bit boundary.

dfFlags

Format of the font bitmap information. Can be one of these values:

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.

dfAspace

Global A space, if any. This member is the distance from the current position to the left edge of the bitmap. This member is present only for Windows 3.x fonts.

dfBspace

Global B space, if any. This member is the width of the character. This member is present only for Windows 3.x fonts.

dfCspace

Global C space, if any. This member is the distance from the right edge of the bitmap to the new current position. This member is present only for Windows 3.x fonts.

dfReserved

This member is not used. This member is present only for Windows 3.x fonts.

dfReserved1

This member is not used. 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.

See also GDIINFO