How to Configure RTL Scripts in FontForge

Configuring Right-to-Left (RTL) scripts like Arabic, Hebrew, or Persian in FontForge requires establishing proper character encoding, assigning script tags, and setting up OpenType Layout features for glyph shaping and positioning. This guide details the essential steps to prepare your font for RTL support, create OpenType substitution lookups, and verify bidirectional text flow using FontForge's built-in tools.

1. Set Font Encoding and Properties

To ensure the font supports RTL characters properly:

  1. Open your project in FontForge.
  2. Navigate to Encoding > Reencode and select an encoding system that includes your target script (such as Unicode BMP or ISO 10646-1).
  3. Go to Element > Font Info > General.
  4. Set the Em Size (typically 1000 or 2048) and verify that Ascent and Descent accommodate script diacritics and ascenders.

2. Configure OpenType GSUB Features

RTL scripts like Arabic rely on contextual glyph substitution based on a character's position within a word (isolated, initial, medial, or final).

  1. Go to Element > Font Info.
  2. Select Lookups from the left-hand panel, then click the GSUB tab at the top.
  3. Click Add Lookup.
  4. In the dialog, set the Type to Single Substitution.
  5. Assign the appropriate OpenType feature tag depending on the shaping stage:
    • isol for Isolated forms
    • init for Initial forms
    • medi for Medial forms
    • fina for Final forms
    • rlig or liga for required ligatures
  6. Click the script/language button (usually marked <New>), and select your script tag (e.g., arab for Arabic or hebr for Hebrew) and language dflt (Default).
  7. Click OK, then click Add Subtable to map your base characters to their shaped variants (e.g., mapping uni0628 to uni0628.init).

3. Set Up GPOS Lookups for Cursive Attachment and Marks

Scripts with continuous baselines or complex vowel markings require Glyph Positioning (GPOS) data:

  1. In the Lookups panel, switch to the GPOS tab.
  2. Click Add Lookup.
  3. For connected scripts like Arabic, select Cursive Attachment (curs) under Type to define entry and exit anchor points on each glyph.
  4. For diacritics and vowel marks, select Mark to Base (mark) under Type and configure mark anchors to ensure accents align properly above or below consonants.

4. Adjust the Metrics Window for RTL Preview

To preview and edit glyph interactions in their natural reading order:

  1. Open the Metrics window by navigating to Metrics > New Metrics Window.
  2. In the text input area at the top, paste or type a sample string in your RTL script.
  3. In the top menu of the Metrics window, choose View > Right to Left to switch the visual reading direction.
  4. Ensure Features in the Metrics menu has your newly created GSUB and GPOS features enabled to verify that substitutions and attachments render automatically.