Check if Glyphs Fit the Em Square in FontForge

Verifying that all glyphs fit within your defined em square in FontForge is essential for avoiding unexpected clipping, baseline alignment issues, and rendering artifacts across different operating systems. This guide outlines how to determine your font's em square dimensions and use FontForge's built-in validation tools, automated problem finders, and scripting capabilities to detect any glyphs exceeding these boundaries.

1. Confirm Your Em Square Dimensions

Before checking glyph dimensions, verify your target em square settings:

  1. Open your font file in FontForge.
  2. Navigate to Element > Font Info.
  3. Select the General tab from the left sidebar.
  4. Note the values for Ascent, Descent, and Em Size (where Ascent + Descent = Em Size, typically 1000 for PostScript/OTF or 1024/2048 for TrueType).
  5. Click OK to close the window.

2. Run the Font Validator

The built-in validator scans your entire font for structural issues, including geometry exceeding expected limits.

  1. Select all glyphs in the font view by pressing Ctrl + A (or Cmd + A on macOS).
  2. Go to Element > Validation > Validate.
  3. Choose the validation profile (standard validation is sufficient) and click OK.
  4. Review the generated error report. Look for warnings such as "Points are outside the bounding box" or extreme coordinates. Double-clicking any error in the list automatically opens the offending glyph so you can scale or adjust it.

3. Use the "Find Problems" Tool

FontForge includes a dedicated problem-detection utility for finer control over coordinate verification:

  1. Select all glyphs in the main font view (Ctrl + A).
  2. Go to Element > Find Problems...
  3. Navigate to the Paths tab.
  4. Check the box labeled Check Bounding Box or look under the Points tab to flag points that fall outside specified metrics.
  5. Click OK. FontForge will step through the selected glyphs and halt whenever a glyph violates the criteria, allowing you to edit the contours directly.

4. Verify Programmatically with the Python Scripting Window

For an absolute and automated check across hundreds of glyphs, use FontForge’s embedded Python console:

  1. Go to File > Execute Script...
  2. Choose Python as the script type.
  3. Paste the following script:
import fontforge

font = fontforge.activeFont()
max_y = font.ascent
min_y = -font.descent

print(f"Checking bounds against Ascent: {max_y}, Descent: {min_y}")

out_of_bounds = []

for glyph in font.glyphs():
    bb = glyph.boundingBox()
    # bb format: (min_x, min_y, max_x, max_y)
    if bb[1] < min_y or bb[3] > max_y:
        out_of_bounds.append((glyph.glyphname, bb))

if out_of_bounds:
    print(f"Found {len(out_of_bounds)} glyph(s) exceeding vertical em limits:")
    for name, bounds in out_of_bounds:
        print(f" - {name}: Y-Min={bounds[1]}, Y-Max={bounds[3]}")
else:
    print("All glyphs fit within the vertical em limits.")
  1. Click OK to run the check. The output appears in your terminal or output window, listing every glyph that exceeds the defined vertical em boundary alongside its exact coordinates.