Export Font Family Hierarchy from FontForge

Exporting an entire font family hierarchy from FontForge requires configuring standardized naming metadata across all your font files, correctly mapping style flags, and exporting each style so operating systems recognize them as a single family. Because FontForge edits one font master at a time, establishing a cohesive hierarchy relies on defining OpenType and PostScript naming tables properly before batch generating the final binaries manually or via scripting.

Step 1: Standardize PostScript Names

For operating systems to group fonts, every style must share the same base family name while having unique individual identifiers.

  1. Open the font file in FontForge.
  2. Navigate to Element > Font Info > PS Names.
  3. Fill out the fields consistently:
    • Family Name: The base name of your family (e.g., MyFont). This must be identical across every weight and style.
    • Fontname: The PostScript identifier with no spaces (e.g., MyFont-BoldItalic).
    • Name for Humans: The full readable name (e.g., MyFont Bold Italic).
    • Weight: The specific weight label (e.g., Bold).

Step 2: Configure OpenType and TTF Names

The TTF Names table dictates how software displays the hierarchy in font pickers.

  1. In the Font Info dialog, select TTF Names.
  2. Set the standard 4-style (RIBBI) entries:
    • Family (ID 1): For standard styles (Regular, Italic, Bold, Bold Italic), use the main family name (e.g., MyFont). For weights outside the core four (like Light, Thin, or Black), older systems require a separate family name (e.g., MyFont Light).
    • SubFamily (ID 2): Must only be Regular, Italic, Bold, or Bold Italic.
  3. Set the extended family hierarchy for modern software:
    • Preferred Family (ID 16): Set this to the true base family name (e.g., MyFont) across all weights.
    • Preferred Styles (ID 17): Set the precise style (e.g., Thin Italic, Black, SemiBold).
    • WWS Family (ID 21) and WWS Subfamily (ID 22): Set these if using extended widths or optical sizes to ensure complete typographic grouping.

Step 3: Set OS/2 Weight and Style Flags

System font grouping depends on matching OS/2 metrics to the chosen hierarchy.

  1. Go to Element > Font Info > OS/2.
  2. Under the Misc tab, set Weight Class (e.g., 100 for Thin, 400 for Regular, 700 for Bold, 900 for Black).
  3. Under the Sub-Family tab, verify the fsSelection flags:
    • Check Bold only for weights 700 and higher that serve as bold counterparts.
    • Check Italic or Oblique for slanted variants.
    • Check Regular only for the standard 400-weight upright style.

Step 4: Export the Hierarchy

Once metadata is standardized across each .sfd source file, generate the family:

Manual Export

  1. Go to File > Generate Fonts.
  2. Select your desired format (OpenType (CFF) for .otf or TrueType for .ttf).
  3. Save all styles into the same target directory.

Automated Batch Export

If your family contains numerous weights, use a FontForge Python script to export all files while preserving the hierarchy settings:

import fontforge
import glob
import os

source_dir = "./sources/*.sfd"
output_dir = "./build/"

if not os.path.exists(output_dir):
    os.makedirs(output_dir)

for file_path in glob.glob(source_dir):
    font = fontforge.open(file_path)
    output_filename = os.path.splitext(os.path.basename(file_path))[0] + ".otf"
    font.generate(os.path.join(output_dir, output_filename))
    font.close()

Run this script through the command line using fontforge -script export_family.py. The generated files will be packaged with matching metadata tables, enabling operating systems and design software to group the files under a unified font family menu.