Fix Contour Winding Direction in FontForge
In digital typography, incorrect contour winding direction causes cutouts and holes in characters (such as the center of an "O" or "B") to fill in with black or disappear entirely during rendering. This issue occurs when the path directions of outer and inner paths fail to follow font format standards, such as PostScript (Counter-Clockwise outer, Clockwise inner) or TrueType (Clockwise outer, Counter-Clockwise inner). This guide explains how to identify, automatically repair, and manually invert contour winding directions across single glyphs or an entire font using FontForge.
Why Contour Direction Matters
Font rendering engines use the non-zero winding rule to determine which areas of a vector glyph should be filled with solid color and which areas should remain empty:
- PostScript / OpenType (CFF): Outer boundaries must run counter-clockwise; inner boundaries (counters/holes) must run clockwise.
- TrueType: Outer boundaries must run clockwise; inner boundaries must run counter-clockwise.
If nested contours share the same direction, rendering engines treat them both as solid shapes, obscuring hollow areas.
Method 1: Automatic Correction Across the Entire Font
FontForge provides an automated function that analyzes nested paths and resets them to the proper conventions based on your font format settings.
- Open your font project in FontForge.
- Select the glyphs you want to fix. To select every glyph in the
font, press
Ctrl + A(orCmd + Aon macOS). - Navigate to the top menu and select Element > Correct Direction.
- Alternatively, use the keyboard shortcut
Ctrl + Shift + D(orCmd + Shift + Don macOS).
FontForge will inspect all selected glyphs, detect nested shapes, and automatically orient the outer and inner paths correctly.
Method 2: Manual Inversion in the Glyph Window
If automatic correction fails on complex or overlapping paths, you can manually reverse the direction of individual contours.
- Double-click the affected glyph in the Font View to open it in the Glyph Outline window.
- Turn on direction indicators by going to View > Show > Path Direction to see the arrows marking path flow.
- Use the Pointer tool (keyboard shortcut
V) to click on a point on the specific contour you need to reverse. - Select the whole contour by double-clicking one of its points, or by choosing Edit > Select > Contours.
- Reverse the path direction using either of the following steps:
- Go to Element > Clockwise or Element > Counter-Clockwise, depending on the desired direction.
- Right-click the selected path and choose Reverse Direction.
- Check that the directional arrows on outer and inner contours now point in opposite directions.
Method 3: Finding Direction Problems with the Validator
To ensure no glyphs with winding errors were missed before exporting:
- Select all glyphs using
Ctrl + A. - Go to Element > Find Problems....
- In the dialog box, click on the Paths tab.
- Check the box labeled Check paths are oriented correctly (and optionally Check self-intersecting).
- Click OK.
FontForge will scan the glyphs and highlight any remaining contour errors, allowing you to review and fix them directly.