How to Fix Negative Advance Width in FontForge

Negative advance width errors occur in FontForge when a glyph's horizontal advance is set to a value below zero, causing characters to overlap backward and triggering validation failures during font export. This guide explains why this error happens and provides straightforward, step-by-step methods to identify the affected glyphs, correct their horizontal metrics manually or in batches, and resolve flipped outline issues to ensure clean font compilation.

Why Negative Advance Width Errors Occur

In digital typography, the advance width dictates how far the cursor moves forward horizontally after rendering a character. A negative advance width means the cursor moves backward instead of forward. This typically happens due to:

  • Accidentally dragging side bearings past the glyph origin in the Glyph View.
  • Importing reversed or negatively transformed vectors from external vector software (like Adobe Illustrator or Inkscape).
  • Outlines drawn outside the baseline and origin boundaries.
  • Metric calculation errors during automated spacing operations.

Step 1: Locate the Offending Glyphs

Before you can fix the issue, you must find which glyphs contain the error.

  1. Open your font file in FontForge.
  2. Go to Element > Validation > Find Problems.
  3. In the dialog box, navigate to the BB & Advance tab.
  4. Check the box for Advance width is negative.
  5. Click OK. FontForge will scan the font and select or highlight all glyphs violating this metric constraint.

Alternatively, you can open the Font View, go to View > Show Metric Titles, and sort your font by advance width to immediately see values below zero.

Step 2: Fix Advance Width via Glyph Metrics

Once the problematic glyphs are identified, you can manually restore a positive advance width.

  1. Double-click the affected glyph to open the Glyph Edit Window.
  2. Go to the top menu and select Metrics > Set Width.
  3. Enter a positive numerical value suitable for the character (for example, matching typical characters like 500 or 600 units depending on your UPM scale).
  4. Click OK.
  5. Check the Left Side Bearing (LSB) and Right Side Bearing (RSB). Ensure the LSB marker (the vertical dashed line at x = 0) sits to the left of the outline, and the RSB marker sits to the right of the outline. You can drag the RSB line to adjust the total width visually.

Step 3: Resolve Flipped or Inverted Outlines

If an advance width turns negative automatically after importing paths or applying transformations, the glyph outline might be horizontally flipped or drawn with inverted direction.

  1. Select the affected glyph in the Font View or Glyph Edit Window.
  2. Go to Element > Correct Direction (or press Ctrl + Shift + D / Cmd + Shift + D). This ensures standard clockwise or counterclockwise winding paths.
  3. If the entire glyph is mirrored, go to Element > Transformations > Transform.
  4. Choose Flip horizontally, or correct any negative scaling factor applied to the horizontal axis (X).
  5. Re-check the width using Metrics > Set Width.

Step 4: Batch Fix Multiple Glyphs

If hundreds of glyphs suffer from negative widths due to an improper global metric calculation or bulk import error:

  1. Select the affected glyphs in the main Font View (hold Shift or Ctrl/Cmd to multi-select, or use Ctrl + A to select all).
  2. Go to Metrics > Set Width.
  3. Input a standard default width, or choose Metrics > Auto Width to let FontForge calculate spacing based on the bounding boxes.
  4. If you want to retain existing side bearings while forcing positive metrics, navigate to Metrics > Set LSB or Set RSB and normalize the values.

Step 5: Validate and Export

After applying corrections, run the validation tool once more to confirm the errors are resolved:

  1. Go to Element > Validation > Validate.
  2. Ensure that no "Advance width is negative" warnings appear in the report.
  3. Save your database file (.sfd) and generate your final font binaries via File > Generate Fonts.