'hdmx' - Horizontal Device Metrics

The Horizontal Device Metrics table stores integer advance widths scaled to particular pixel sizes. This allows the font manager to build integer width tables without calling the scaler for each glyph. Typically this table contains only selected screen sizes. This table is sorted by pixel size. The checksum for this table applies to both subtables listed.

Note that for non-square pixel grids (for example, on an EGA), the character width (in pixels) will be used to determine which device record to use. For example, a 12 point character on an EGA (resolution of 72x96) would be 12 pixels high, and 16 pixels wide, and the hdmx device record for 16 pixel characters would be used.

If bit 2 of the flag field in the 'head' table is not set, then it is assumed that the font scales linearly; in this case an 'hdmx' table is not necessary and should not be built. If bit 2 of the flag field is set, then one or more glyphs in the font are assumed to scale nonlinearly. In this case, performance can be improved by including the 'hdmx' table with one or more important DeviceRecord's for important sizes. Please see the chapter "Recommendations for Windows Fonts" for more detail.

The table begins as follows:

Type

Description

USHORT

Table version number (starts at 0)

SHORT

Number of device records.

LONG

Size of a device record, long aligned.

DeviceRecord

Records[number of device records].


Each DeviceRecord for format 0 looks like this.

Type

Description

BYTE

Pixel size for following widths (as ppem).

BYTE

Maximum width.

BYTE

Widths[numGlyphs] (numGlyphs is from the 'maxp' table).


Each DeviceRecord is padded with 0's to make it long word aligned.

Each Width value is the width of the particular glyph, in pixels, at the pixels per em (ppem) size listed at the start of the DeviceRecord.

The ppem sizes are measured along the y axis.