The 'hhea' table

General table information

The 'hhea' table contains information needed to layout fonts whose characters are written horizontally, that is, either left to right or right to left. This table contains information that is general to the font as a whole. Information which pertains to specific glyphs is given in the 'hmtx' table defined below.

The table begins with a version number. It includes values which represent the design intentions of the font's designer (ascent, descent and linegap) as well as values that are computed and which must be consistent with the data appearing in the 'hmtx' table (advanceWidthMax, minLeftSideBearing, minRightSideBearing).

The 'hhea' table uses the concept of extent. The extent is the distance from the left side bearing to the right most positions in the glyph outline.

The caretSlopeRise and caretSlopeRun are used to specify the proper angle for the caret when displayed with this font. A rise of 1 and run of 0 will specify a vertical caret. A rise of 0 and run of 1 will specify a horizontal caret. Something in-between will be desirable for fonts whose glyphs are obliqued or italic.

The caretOffset value is the amount by which a slanted highlight on a glyph needs to be shifted to produce the best appearance. Since caretOffset is a signed FUnit value, it will scale.

A number of fields in this table are reserved and should be set to a value of zero.

The values for ascent, descent and lineGap represent the design intentions of the font's creator rather than any computed value. The values for the advanceWidthMax, minLeftSideBearing and minRightSideBearing are computed values and must be consistent with whatever values appear in the 'hmtx' table. These values are as their names imply, the maximum advance width for any glyph in the font, the minimum left side bearing for any glyph and the minimum right side bearing for any glyph.

The value numOfLongHorMetrics is used by the 'hmtx' table.

Table 23 : 'hhea' table
Type
Name
Description
Fixed version 0x00010000 (1.0)
FWord ascent Distance from baseline of highest ascender
FWord descent Distance from baseline of lowest descender
FWord lineGap typographic line gap
uFWord advanceWidthMax must be consistent with horizontal metrics
FWord minLeftSideBearing must be consistent with horizontal metrics
FWord minRightSideBearing must be consistent with horizontal metrics
FWord xMaxExtent max(lsb + (xMax-xMin))
int16 caretSlopeRise used to calculate the slope of the caret (rise/run) set to 1 for vertical caret
int16 caretSlopeRun 0 for vertical
FWord caretOffset set value to 0 for non-slanted fonts
int16 reserved set value to 0
int16 reserved set value to 0
int16 reserved set value to 0
int16 reserved set value to 0
int16 metricDataFormat 0 for current format
uint16 numOfLongHorMetrics number of advance widths in metrics table

 


Mac OS-specific information

Although it is officially listed as a "required" TrueType table, the 'hhea' table is not in fact required for all sfnt-housed fonts on the Mac OS.

Non-TrueType fonts housed in an sfnt data structure may not have a 'hhea' table. This is allowed by the OFA2 architecture.

TrueType fonts which have no outline data but consist of bitmaps only should not have a 'head' table. They should use the byte-by-byte identical 'bhed' table instead. The Mac OS uses the presence of a 'bhed' to signal the fact that a font has no outlines. Such fonts may also lack an 'hhea' table.

Newton-specific information

Although they consist of bitmaps only, Newton fonts are required to have the 'hhea' table.

Dependencies

Other tables may have information duplicating data contained in the 'hhea' table, most notably the ascent and descent fields. Such information may be found in tables such as the 'OS/2' table or the 'bloc' table. Care should always be taken that metric information within a font is consistent, as different applications and systems get the metric information from different places.

This is particularly true for fonts intended for cross-platform use. E.g., Windows uses the 'OS/2' table as the basic source for ascent and descent for the font.

The value of the numOfLongHorMetrics field is used by the 'hmtx' (Horizontal Metrics) table. Fonts that lack an 'hhea' table must not have an 'hmtx' table.

Tools

Editing of the 'hhea' table is possible using TrueEdit. Other tools may automatically update fields in the 'hhea' table as needed, most notably the advanceWidthMax.


Change Log

15 February 2000
Noted that this table is not required in non-TrueType sfnt-housed fonts.
1 October 1996
Created unified TrueType book.
applefonts@apple.com

[Table of Contents]