Khotot/Tutorial
Here we'll summarize the process of developing Arabeyes TrueType fonts.
محتويات
Requirements
- FontForge: FontForge is our main font editing and development software, it is a free software. You will need version 20070723 at least. [1]
- ...
Diacritic Marks (Harakat)
One of the most annoying problems is the lack of proper Arabic diacritics support in free fonts (and even most non-free fonts). For a given font, it must provide some features to support Arabic diacritics properly:
- The very first feature is to make diacritic marks lay over base glyphs, this is achieved by making diacritic glyphs zero width glyphs.
- The ability to set the diacritic mark relative to each glyph, as compared with poorly designed fonts where all diacritic marks lay at the same level regardless to the underlying base glyph. This can be achieved by using anchor points.
- The ability to place Diacritics properly over ligatures [2].
- The ability to place Diacritic marks correctly in relation to each other, what so called stacked diacritic marks, like Shadda with Fatha over it.
Editing the font
Setting diacritic marks to Zero width
Open the font with FF, from font view select diacritic glyphs (from U+064B to U+0652). Go to "Metrics -> Set Width...", from the dialog check "Set Width To:" and set its value to 0.
Anchor points
Anchor points are points that is used to tell font rendering engine where to put to glyphs in relation to each other [3]. For diacritic positioning we need 3 classes of anchor points:
- Mark to Base: mark in relation to base glyph, say Dammah over Alef.
- Mark to Ligature: mark in relation to ligature, say Fathah over Lam Alef.
- Mark to Mark: mark in relation to another mark, Fathah over Sahaddah for example.
You need to add lookup tables and sub tables in order to set anchor point classes. Refer to FF manual for detailed description [4].
To automate the process of Adding lookup tables, sub tables, anchor classes and anchor points, we have a set of scripts that do assist this, get it from https://gitlab.com/arabeyes-art/khotot/tree/master/tools
.
There are 2 scripts related to anchor points; addlookups.pe
and addanchors.pe
. Say you are working on Font.sfd file, you can run the scripts against it either from the command line:
./addlookups.pe Font.sfd ./addanchors.pe Font.sfd
NOTE:
- The scripts can accept multiple files at once;
./addlookups.pe *.sfd
- You MUST run addlookups.pe script first.
Also, you can open the font in FF, then go to "File -> Execute Script", check FF check box, then use "Call..." button to open the script and run it against the font.
After doing this, you'll have anchor points set for each glyph, now we need to manually adjust those anchor points to get the desired behaviour.
When you open on any glyph, in the Arabic Unicode Block of course, in glyph view, you will find tow anchor points; ArabicAbove and ArabicBelow.
ArabicAbove anchor point is used to mach diacritic marks that lay above base glyph, like fatha, shadda and dammah. While ArabicBelow is utilized by diacritics that lay below base glyph, like kasrah.
Ligatures are special glyphs, each ligature have an anchor point of each class for each component. Lam alef has 2; one for lam and one for alef.
To start adjusting anchor points, open the glyph and move anchor points around as suited. For a better experience, you can use anchor control dialog which provides a more convenient way to edit the anchor points and to see its effect promptly.
Go to Element -> Font Info -> Lookups -> GPOS , choose one of the lookup tables, click on the [+] to open its subtables, select a subtable then click on "Edit Data" button from the side pan. From the dialog select an anchor point then click on Anchor control button.
From anchor control dialog you can adjust anchor points as appropriate and see its effect, use Page Up and Page Down to navigate through glyphs.
- ↑ FontForge can be found in its web page, fontforge.sourceforge.net.
- ↑ A ligature is a combination of two characters or more into one glyph, the only mandatory ligature in Arabic is Lam Alef.
- ↑ FontForge Manual - Overview of Anchors.
- ↑ FontForge Manual - Manipulating OpenType Lookups.