Editing Hhea Metrics in FontForge

This guide explains the function of the Horizontal Header (hhea) table in OpenType and TrueType fonts and provides a clear, step-by-step procedure for editing its metrics using FontForge. You will learn what role this table plays in determining cross-platform line spacing and how to safely adjust its primary values—Ascent, Descent, and Line Gap—within the FontForge interface.

What is the Hhea Table?

The hhea (Horizontal Header) table is a required table in TrueType and OpenType fonts containing general information for horizontal text layout. While it records properties like maximum advance width and extent values, its most critical components are the vertical metric fields:

  • Ascent: The distance from the baseline to the top of the font's intended clipping area or typical glyph bounds.
  • Descent: The distance from the baseline to the bottom of the font's bounds (expressed as a negative number in the OpenType specification).
  • LineGap: The recommended extra vertical space added between lines of text.

Together, these values determine line height and baseline positioning, primarily targeting macOS and Apple rendering engines. They work in tandem with the OS/2 table metrics (sTypo and usWin values) used by Windows and web browsers to establish consistent cross-platform line spacing.

How to Edit Hhea Metrics in FontForge

Although the hhea table is technically separate from the OS/2 table in the compiled font file, FontForge manages vertical metrics for both systems in the same configuration panel.

  1. Open Your Font: Launch FontForge and open the font file (.otf, .ttf, or .sfd) you wish to edit.
  2. Open Font Info: In the top menu bar, click on Element and select Font Info... (or press Ctrl + Shift + F on Windows/Linux, Cmd + Shift + F on macOS).
  3. Navigate to Metrics: In the left sidebar of the Font Info window, click on OS/2, then select the Metrics tab at the top of the panel.
  4. Locate Hhead Settings: Scroll down or locate the fields labeled Hhead Ascent, Hhead Descent, and Hhead Line Gap.
  5. Adjust the Values:
    • Hhead Ascent: Enter your desired value in font units (positive integer).
    • Hhead Descent: Enter your desired descent value. Note that in standard TrueType/OpenType specifications, this is a negative value (e.g., -200).
    • Hhead Line Gap: Enter the desired buffer space between successive lines of text.
    • If FontForge is automatically calculating these values based on the absolute highest and lowest glyph bounding boxes, uncheck the corresponding "Is Offset" or calculation checkboxes (if present) to override them with manual values.
  6. Save Changes: Click OK at the bottom of the Font Info dialog to apply your adjustments.
  7. Export the Font: Navigate to File > Generate Fonts... to re-export your updated .otf or .ttf file.

Best Practice for Consistency

To prevent text clipping and ensure consistent line spacing across platforms, match your Hhead Ascent and Hhead Descent values as closely as possible to your OS/2 sTypoAscender and sTypoDescender values (accounting for the sign convention), and set Hhead Line Gap to match sTypoLineGap.