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:
- Open your project in FontForge.
- Navigate to Encoding > Reencode and select an encoding system that includes your target script (such as Unicode BMP or ISO 10646-1).
- Go to Element > Font Info > General.
- 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).
- Go to Element > Font Info.
- Select Lookups from the left-hand panel, then click the GSUB tab at the top.
- Click Add Lookup.
- In the dialog, set the Type to Single Substitution.
- Assign the appropriate OpenType feature tag depending on the shaping
stage:
isolfor Isolated formsinitfor Initial formsmedifor Medial formsfinafor Final formsrligorligafor required ligatures
- Click the script/language button (usually marked
<New>), and select your script tag (e.g.,arabfor Arabic orhebrfor Hebrew) and languagedflt(Default). - Click OK, then click Add Subtable
to map your base characters to their shaped variants (e.g., mapping
uni0628touni0628.init).
3. Set Up GPOS Lookups for Cursive Attachment and Marks
Scripts with continuous baselines or complex vowel markings require Glyph Positioning (GPOS) data:
- In the Lookups panel, switch to the GPOS tab.
- Click Add Lookup.
- For connected scripts like Arabic, select Cursive
Attachment (
curs) under Type to define entry and exit anchor points on each glyph. - 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:
- Open the Metrics window by navigating to Metrics > New Metrics Window.
- In the text input area at the top, paste or type a sample string in your RTL script.
- In the top menu of the Metrics window, choose View > Right to Left to switch the visual reading direction.
- Ensure Features in the Metrics menu has your newly created GSUB and GPOS features enabled to verify that substitutions and attachments render automatically.