FontForge Contour Direction: PostScript vs TrueType

Contour direction, or winding order, determines how rendering engines identify solid shapes versus cutouts in digital typography. PostScript and TrueType formats rely on opposite winding conventions to display letterforms correctly. This guide outlines the specific contour direction rules for both PostScript and TrueType formats and demonstrates how to inspect, correct, and automate these paths using FontForge.

The Winding Order Rules

Rendering engines evaluate vector paths using winding rules to establish what is filled and what is transparent (holes). Each format follows a distinct convention:

  • PostScript (OTF, CFF, Type 1): Outer contours must run counter-clockwise (CCW). Inner contours (holes, such as the center of an "O") must run clockwise (CW).
  • TrueType (TTF): Outer contours must run clockwise (CW). Inner contours (holes) must run counter-clockwise (CCW).

Failing to follow these conventions can result in rendering artifacts, filled-in counters, or rasterization failures across various operating systems and rendering engines.

Viewing Contour Direction in FontForge

By default, FontForge indicates contour direction via directional arrows along the path segments in the Glyph Outline View.

  1. Double-click any glyph in the font matrix to open the Glyph Outline Window.
  2. Observe the vector points. Each selected contour shows directional arrows pointing along the direction of the path.
  3. If the arrows are difficult to see, toggle the fill view by pressing Ctrl + D (or Cmd + D on macOS) or selecting View > Fill to quickly verify whether inner contours properly cut out from outer shapes.

Correcting Contours Manually

FontForge natively edits contours using the PostScript convention (outer counter-clockwise, inner clockwise).

To correct paths across one or multiple glyphs:

  1. Select the glyphs you wish to fix in the main font view, or select all points inside a single glyph editor (Ctrl + A).
  2. Navigate to Element > Correct Direction (Shortcut: Ctrl + Shift + D or Cmd + Shift + D).
  3. FontForge will automatically detect nested paths, setting exterior boundaries to counter-clockwise and interior cutouts to clockwise.

If an individual path remains inverted:

  1. Click a single point on the problematic path to select the contour.
  2. Navigate to Element > Reverse Direction.

Managing Formats During Export

Because FontForge maintains PostScript orientation internally, you do not need to manually invert your entire font before exporting to TrueType. FontForge manages format conversion automatically during generation:

  1. Go to File > Generate Fonts.
  2. Select TrueType from the drop-down menu.
  3. Click the Options button next to the format selection.
  4. Ensure that the export routine handles path direction conversion. When exporting to TrueType, FontForge automatically reverses the contour directions to match TrueType's clockwise standard.
  5. When exporting to OpenType (CFF), FontForge retains the native counter-clockwise PostScript orientation.

Validation and Problem Detection

Before final export, run FontForge's validation routines to catch any stray, flipped, or intersecting paths:

  1. Select all glyphs in the font view (Ctrl + A).
  2. Go to Element > Validation > Find Problems.
  3. Under the Paths tab, check Check Direction and Intersecting paths.
  4. Click OK.

FontForge will review the glyphs and flag any paths where nested loops share the same direction or where complex intersections prevent predictable filling.