Creating an Arabic font

Tutorial
by Rainer Erich Scheichelbauer
en fr zh

10 March 2021 Published on 6 October 2012

Been looking for a quick and easy introduction to Arabic in Glyphs? This is it.

Set up your document

When you start Glyphs, you will be either greeted by the Start Window, or you can bring it up any time later through File > New from Glyph Sets:

In the document building dialog, you simply choose the scripts you want to include. To get started, I recommend to first select Arabic. Scripts are listed alphabetically, so, depending on the localization, it will usually be displayed right at the top. Then turn on the option to prepare glyphs:

… and choose the subsections of Arabic you want to include. For starters, I recommend Basic Shapes, and perhaps Basic too.

Don’t worry about what you have not selected yet. You can always add more glyphs at a later time. Here is how. Even if you start with an empty document, you can add glyphs in multiple ways. The easiest way is via the sidebar in Font view (Cmd-Opt-1): In the Languages section, open Arabic (add it through the plus button if it is not listed yet), right click on any of the subsections with number badges, e.g. Basic Shapes, and choose the glyphs you want to add from the list of Missing Glyphs that appears, or simply choose all of them:

Then press Generate to add the selected glyphs to your font. The number badge will turn into a check mark once every glyph has been included in the font, simply to indicate that this section is complete.

Start with Basic Shapes

Okay, so let’s select Arabic > Basic Shapes in the sidebar, so Font view will only display relevant glyphs. Of course, you can start with anything, but the Basic Shapes are indeed a good place to start because it contains shapes that are reused a lot in other glyphs.

I like to start with the ‘dotless beh’. If you can read Arabic, you will probably say, ‘Wait a minute, there is no beh without a dot, the beh always has a dot underneath.’ And you are right, of course. Though, imagine for a moment that you take the beh, but leave out its dot. Then you end up with a shape that you can reuse for the teh and the peh, some positional forms of it even for the yeh and the noon. Makes sense. And that is what we refer to as a ‘basic shape’.

The glyphs we are looking for are all called behDotless-ar, indicating the dotless beh of the Arabic script, and the positional variants will have additional dot suffixes .fina for the final or terminal position, .medi for the medial position, and .init for the initial position. The one without a suffix is the isolated shape. The four-letter suffixes correspond to the OpenType features with the same tags, in case you wondered. So let’s find and select them:

… and open a new Edit tab with them (as opposed to the Font tab we already have), either by choosing View > New Tab or by pressing the corresponding keyboard shortcut Cmd-T:

Now you see, the four variants of the dotless beh are written next to each other in this Edit tab, and the isolated behDotless-ar is open for editing on the left. Don’t be confused: all four glyphs are as empty as can be. The grey shapes you see are mere placeholders, making the glyph identifiable as long as it is still empty. They will disappear as soon as you draw anything in them.

So let’s start drawing the isolated dotless beh. A good departing point is to draw a skeleton line with the Draw tool (shortcut P), and take the vertical metrics as a reference (View > Show Metrics, Cmd-Shift-M, and View > Show Metrics Names).

Add extremums to it with Paths > Add Extremes, and clean up the path with Paths > Tidy up Paths (Cmd-Shift-T) or removing individual nodes by selecting them with the Select tool (shortcut V) and pressing the Delete key on your keyboard. You may end up with something like this:

Once you are done with the skeleton, you can expand it with Filter > Offset Curve, using the Make Stroke option and experimenting with the other values:

Let’s not forget to set sidebearings in the grey info box (View > Show Info, Cmd-Shift-I). I will use 50 as its left sidebearing (LSB) and mirror it with the metrics key =| on the right sidebearing (RSB):

What =| does is that it takes the value of the opposite sidebearing and uses it in the current sidebearing. So in the RSB, it is a shortcut for the LSB, and vice versa. Quickest way to center a drawing in its glyph width. Eventually you will end up with something like this:

Beautiful! Now we need to add anchors with Glyph > Set Anchors (Cmd-U). Anchors indicate positions where dots and vowel marks can connect. This will be important for building the teh and the beh later on. With the Select tool (shortcut V), move them to their approximate position, like this:

The top anchor is for connecting dots and vowel marks that will go above the letter, and you guessed it, the anchor named bottom is for all the dots and marks that go below the letter. The ring anchor is for the Pashto letter teh with ring (U+067C). If you do not plan on Pashto support, you can also delete the ring anchor.

Positional Shapes

Metrics for the connectors

We mentioned it briefly above already. By default, the unsuffixed glyph is assumed to be the isolated form. In Arabic, of course, many letters have some or all other possible positional variants: final, medial and initial. We differentiate between them with a dot suffix in the glyph name. We have the positional variants of behDotless-ar already on the screen, albeit empty.

Design-wise, we can do a lot of copying and pasting of paths between the positional variants, because even though they are different, they will still bear a lot of similarity, except for the connecting strokes. Those joining or connecting strokes all need to be at the same height, so positional shapes can interlock properly and shape a connected word.

The bottom of the connecting stroke is called the baseline, and its upper edge is referred to as the joining line height. While the baseline is defined at y coordinate zero and common throughout many writing systems, the joining line height is specific to Arabic, and its value is the same as the stroke width we created. You can set the joining line height in File > Font Info > Masters > Metrics:

A click on the respective line brings up a dialog in which you can change name, and glyph scope of the metric. Lucky me, I can stick with the defaults of Joining Line, and Arabic script. Directly in the line, you can alter the position (default 100), and its overshoot (default 16). Consider adding more metrics that may make sense for your design. For instance, in a very geometric design, you may add one or two stroke heights that appear often in your letters.

Drawing positional variants

Cool, so now that we have everything in place, we just need to paste the paths from one positional shape into the next and make the necessary adjustments. Remember: double click a glyph to open it for editing. Make sure the stroke endings lie snug with the sidebearing, i.e., make the sidebearing zero for connecting stroke ends:

Do not forget to add and position anchors for each glyph. Looks good, but… we are not done yet.

Cap components as stroke endings

What we need to add is little overlaps at the butts of our connecting strokes. Why? Because you will have trouble with renderers that will display little but distracting artefacts where the letters join:

So just extend the strokes, right? No, it makes it worse:

So, where the letters join, the nodes really need to click in each other. We need to extend in the middle of the stroke butts. From experience, half circles or just a pointy triangle shapes at the stroke endings work best:

Whichever shape you pick, it is a good idea to keep them consistent throughout the font. Otherwise you will end up with all sorts of artefacts when letters connect. Of course you can draw and manage these endings yourself. But since you will end up with hundreds, if not thousands, of these connectors, wouldn’t it be great if we could draw that stroke butt once and reuse it uniformly every time, and thus save hours of work?

Well, it is your lucky day today, because we have exactly that feature built into Glyphs, and it is called cap components. Here is what you do. Choose Glyph > Add Glyphs (Cmd-Shift-G), and in the upcoming dialog sheet, enter the name of the cap glyph. It must start with _cap, followed by an arbitrary dot suffix, e.g., _cap.strokebutt:

You will see a new glyph opened for editing. Now let’s make sure we have our Arabic metrics in the glyph, because the joining line height is not visible. Remember that the scope of the metric was Arabic glyphs? We can simply redefine our cap as Arabic, and the glyph will show Arabic metrics. It’s that easy. To achieve that, we need to change the info about the glyph, so while _cap.strokebutt is still open for editing, choose Edit > Info for Selection (Cmd-Opt-I), and in the glyph info dialog, enable the Script checkbox and set it to arabic:

Then confirm the dialog by pressing OK. Now, all you need to do is draw your cap from the baseline to the joining line height, and add an origin anchor on top of the start point:

You can add anchors by right-clicking and choosing Add Anchor from the context menu, then change its name to origin. Alternatively, Glyph > Add Anchors will add the default anchors origin, left and right. If you do it that way, just select and delete left and right because we will not need those. In any event, move the origin on top of the bottom node.

The path direction is important: pay attention to the blue arrow indicator. If you drew it the wrong way around, you can select the path with the Select tool (shortcut V), right click and choose Reverse Selected Contours from the context menu.

One last thing: for technical reasons, we need to rotate everything in the cap glyph 90° clockwise. That is because, caps need to be drawn as if the were attaching to the bottom of a vertical stem. Easy, select all (Cmd-A), type in 90 in the rotation field of the Transformations palette in the sidebar on the right, and click the Rotate CW button:

And your cap will look something like this:

If you have the origin anchor on the first point, it does not really matter where exactly this path-and-anchor structure is on the canvas. However, if you, for whatever reason, want to avoid the origin anchor, you would need to move the open path to the intersection of left sidebearing and baseline. That point is also known as the ‘origin’ of the coordinate system because it has the Cartesian coordinate x=0, y=0. And that is exactly where the first point of the open path needs to sit. I knew I could not hide that from you.

Okay, back to the medial, initial and final letter. What they all have in common are open stroke ends like this one:

Now is the time to attach the cap component to exactly these stroke endings. Select the two adjacent corner nodes at the end of a positional glyph, right click, and choose Add Cap Component. (The command only appears in the menu if there is one or more pairs of adjacent corner points selected.) In the upcoming dialog, Glyphs will ask you which cap component you want to add to the line segment. Easy choice this time:

Once you press the Return key, or double click the entry with the appropriate cap name, the cap component gets injected into the path:

Some designers treat all their connecting stroke endings like this. However, to save yourself some work it is best to only add caps to the entering strokes:

Cool. Now, dotless behs are nice, but they only get you that far in modern Arabic written communication. So, I think we are ready for the next step: let’s take care of our dotlessness.

Adding marks

Dot glyphs and vowel marks

In Font view (Cmd-Opt-1), you can either filter for marks in the Categories, or just click on the Basic Shapes or Basic sections again, and scroll down to the Mark chapter:

You see, the names are pretty self-explanatory. So let’s open up one of them for editing, e.g., dotbelow-ar so we can finally build a proper beh. Pick the Primitives tool (shortcut F) from the toolbar, and if necessary, click and hold to switch from rectangle to ellipse (Shift-F). Then, in a position below the baseline you deem appropriate, click and drag on the canvas to put a circle there. Edit its curvature with the Fit Curve palette in the sidebar, and fine-tune its position and size in the grey info box at the bottom (Cmd-Shift-I):

As reference for drawing and placing the dot, you can insert a dotless beh next to it. Once you have added anchors with Glyph > Set Anchors (Cmd-U), and anchors are selected, you will see a preview of all available marks in all letters currently in Edit view. We call this the ‘mark cloud’ because as you keep adding more and more marks, the superimposed display of marks will become truly ‘cloudy’:

You see, marks have different anchors than letters. Above marks have _top and top anchors. An anchor that starts with an underscore _ connects to the anchor of the same name in the previous component, just without the underscore. I.e., _top in our mark attaches to top in the previous component, which can either be a letter or another mark. That is why marks not only have _top, but also top, so they can serve as base for a following mark.

Same is true for _bottom and bottom anchors in below marks, just that it stacks downwards rather than upwards.

Where were we? Oh yes, the dot marks! Yeah, just fill them all up. If you just plan to support basic Arabic and Persian, then add at least these:

dotabove-ar
dotbelow-ar
twodotshorizontalabove-ar
twodotshorizontalbelow-ar
threedotsdownbelow-ar
threedotsdowncenter-ar
threedotsupabove-ar

You have added them as part of the Basic Shapes group already. In case you have not, you can copy and paste these lines into Glyph > Add Glyphs… (Cmd-Shift-G), and confirm the dialog with Generate. And then add your drawings:

If you select them in the Font tab (Cmd-Opt-1), you can batch-set their sidebearings again, e.g. to LSB 100 and the same in the RSB:

I used metric keys for both LSB and RSB, =100 and =|. That way, you can conveniently reset their sidebearings at any later point by selecting the glyphs and choosing Glyph > Update Metrics (Ctrl-Cmd-M) or, if you have a multiple-master setup, by adding the Option key and choosing Glyph > Update Metrics for All Masters (Ctrl-Cmd-M).

To be frank with you, sidebearings of (non-spacing) marks do not really matter that much, because they get positioned with our anchors anyway. Having consistent sidebearings makes editing and managing them more comfortable in Glyphs, though.

Composing

Now that we have our base letters (the dotless beh’s) and our dot marks in our font, we can put them together by building composites. A composite glyph is a glyph that contains components instead of Bézier paths. A component is a live, hot-linked reference to a different ‘original glyph’ or ‘base glyph’. If the original (or base) glyph changes, the component changes as well.

For instance, a teh consists of a ‘dotless beh’ component and a ‘two dots above’ component. You would insert the dotless beh component first, and the teh inherits its width right away, and all mark components get stacked on it later by means of the anchors. You could go into teh-ar, then choose Glyph > Add Component (Cmd-Shift-C) or with the Option key Add Component for All Masters (Cmd-Opt-Shift-C), then pick the base letter behDotless-ar, and repeat the same for the mark twodotshorizontalabove-ar.

You could. But you do not have to. In our built-in glyph database, we have myriads of composition recipes for all glyphs that can be sensibly composed out of others. And unless you are doing something unusual, you can simply invoke these recipes.

Glyph > Create Composite Glyph (Ctrl-Cmd-C) will delete the current contents of the selected glyph and rebuild it from scratch with the components from the recipe stored in the glyph database. It will not do anything if there is no component recipe for the selected glyph. If you are working on a multiple master setup, hold down the Option key to turn the command into Glyph > Create Composite Glyph for all Masters (Ctrl-Opt-Cmd-C). And the best thing: this also works for a selection of multiple glyphs. For instance, all of these glyphs were done in one go:

Pretty cool. That is why it is a good idea to first complete the Basic Shapes, so you can compose a whole bunch of composites in no time. It goes so quickly in fact, you can lose track of things easily. If that happens to you, you can find out all the glyphs in which the current glyph is used as a component. To do that, right click anywhere in the canvas and choose the CMWTLN (command with the long name):

Great for doing anchor position adjustments:

Thanks to the anchors, the components are automatically aligned, and composites follow foot as soon as you move an anchor.

More letters

Of course, there are more Arabic letters than just the ones we have made so far. You’ll find good descriptions in a few places. Watch out, not all letters have all four different shapes (isolated, initial, medial, final).

And again, Glyphs can help you a lot. To go through the built-in glyph database, open Window > Glyph Info and type -ar.init, -ar.medi or -ar.fina into the search box. To find all variations, search for -ar. et cetera. You get the idea.

This way, you also have access to all the rare glyphs that are not listed in the Arabic sidebar in the Font tab. Uh-oh, I think I’ve whetted your appetite.

Testing from right to left

Switch the current Edit tab to RTL text setting by clicking on the RTL button in the bottom right:

And then type away with your favourite Arabic keyboard layout in System Preferences > Keyboard > Input Sources. I admit it, I like the Jawi one for expressing my deepest feelings:


Yes, I admit it, I am a total cheat. There are many more letters in this font already than I showed you above. In fact, Nadine Chahine’s superpowers helped me here a lot. But it is way more fun if you have more letters already.

What you see is that the correct positional shape is taken right away when you type in RTL mode. Comes in very handy for test driving your font.

On the other hand, though, it can be annoying if you want to single out and work on a certain positional shape. In that case, it is a good idea to switch back to LTR, and the glyphs will not switch between positional variants.

OpenType features

Glyphs will autocreate the OpenType features necessary for making an Arabic font work if you stick to ‘nice names’, our suggested glyph naming scheme. Simply go to File > Font Info > Features and press the Update button, and voilà:

If you need to add something to an existing automated feature, just duplicate (copy and paste) the existing feature in the sidebar, disable automation by unchecking the Generate automatically checkbox, and replace the code with whatever you prefer:

And classes can be automated as well, of course. For one thing, there is a prepared ArabicLetters in the Classes menu, which appears when you click on the plus button next to the Classes header in the sidebar.

And of course you can also add your own class code tokens! In a nutshell, these tokens are logical descriptions of the glyph names you want to have in your OpenType class. A token will expand to a space-separated list of glyph names, and can be put anywhere it makes sense to you, e.g., in a class definition instead of typing out all the glyph names, or between brackets directly inside feature code. Here are some handy samples for Arabic:

  • $[script like "arabic" and category like "Letter"]: recreates the ArabicLetters class
  • $[script like "arabic" and category like "Number"]: glyph names of all Arabic figures
  • $[script like "arabic" and name like "*.fina*"]: all final Arabic glyphs
  • $[script like "arabic" and subCategory like "Ligature"]: all Arabic ligatures

And so on, you get the idea. For more info on tokens, read the Tokens tutorial.

Ligatures and their suffixes

A word about ligatures. A ligature, technically, is a substitution for other glyphs, usually letters. The substituted glyphs are reflected in the ligature name in an easy way: they are concatenated with underscores. So, e.g., a ligature of x, y and z would be called x_y_z. After that follows a script suffix, -ar in the case of Arabic. And after that follow optional dot suffixes, typically a 4-letter OpenType feature tag like .ss01. So, we have the basic structure of a ligature name: glyph1_glyph2-script.suffix, which means that this ligature is the replacement for the sequence glyph1 glyph2, belonging to script, triggered through an OpenType feature mechanism indicated by suffix.

In Arabic, of course, it is clear that the ligatures also need to have a position. In other words, a ligature can be initial, medial, final or isolated, just like other letters. Now, let’s be logical:

  • An initial ligature must substitute an initial glyph followed by one or more medial glyphs. That’s logical because an initial ligature must be at the beginning, so the first glyph it replaces must be initial as well. But an initial ligature must connect to something that follows. That means that the second substituted glyph must connect as well, so it must be medial. So xxx_yyy-ar.init is substitution for xxx-ar.init yyy-ar.medi.
  • Following the same logic, a medial ligature must consist of medial glyphs. In other words, xxx_yyy-ar.medi substitutes xxx-ar.medi yyy-ar.medi.
  • A final ligature must consist of one or more medial glyphs, terminated by a final shape. That means, xxx_yyy-ar.fina substitutes xxx-ar.medi yyy-ar.fina.
  • An isolated ligature must start with an initial shape and end with a final shape. So, xxx_yyy-ar (.isol suffix is optional) substitutes xxx-ar.init yyy-ar.fina. Special case: if it replaces three or more glyphs, the ones in between must be medial. That means: xxx_yyy_zzz-ar substitutes xxx-ar.init yyy-ar.medi zzz-ar.fina.

I know it seems a little tricky at first, but once you get the hang of it, it makes perfect sense. To recapitulate, here is all of the above expressed in OpenType feature code:

# initial ligatures:
sub xxx-ar.init yyy-ar.medi by xxx_yyy-ar.init;
sub xxx-ar.init yyy-ar.medi zzz-ar.medi by xxx_yyy_zzz-ar.init;

# medial ligatures:
sub xxx-ar.medi yyy-ar.medi by xxx_yyy-ar.medi;
sub xxx-ar.medi yyy-ar.medi zzz-ar.medi by xxx_yyy_zzz-ar.medi;

# final ligatures:
sub xxx-ar.medi yyy-ar.fina by xxx_yyy-ar.fina;
sub xxx-ar.medi yyy-ar.medi zzz-ar.fina by xxx_yyy_zzz-ar.fina;

# isolated ligatures:
sub xxx-ar.init yyy-ar.fina by xxx_yyy-ar; # .isol suffix is optional
sub xxx-ar.init yyy-ar.medi zzz-ar.fina by xxx_yyy_zzz-ar; # .isol suffix is optional

And now, after I dragged you through all of this, I have the good news for you: Glyphs can create the feature code for positional ligatures automatically. Ha ha! The app will build the code for you, provided that you have all of the glyphs involved in your font, of course. But now that you know how it works, and how to name your Arabic ligatures, it’s a piece of cake for you.

Optional: cursive attachment

Some Arabic fonts follow a ‘cascading style’. That means that the incoming stroke and the outgoing stroke of a medial shape are not on the same height, so when the letters connect to form a word, the letters descend step by step:

I hope سبتبتبتم does not mean anything nasty in any language.

How would you solve this? Well, with something called ‘cursive attachment’: we can tell the font exactly where the connection between letters should happen. You do that by adding so-called exit and entry anchors. Let’s do that for our medial dotless beh, a.k.a. behDotless-ar.medi.

First of course, we adapt its design to a descending cascade. Can be done with a good selection and the appropriate amount of ‘nudging’, i.e., moving the selection with the Ctrl and Opt keys held down, and the curve segments adjacent to the selection will be scaled proportionally:

Now let’s actually add anchors. Right click on the canvas and choose Add Anchor from the context menu that pops up:

An anchor called ‘new anchor’ will be added where you clicked, and its name is selected for editing:

So we can type exit right away, and we repeat the process for entry. Next, we move the anchors to appropriate places, entry at the beginning on the right, exit at the end of the stroke on the left. If we have no better idea, it is best to put them on the baseline or what corresponds to the baseline. This minimises rounding errors and keeps things manageable. Horizontally, they should align with the sidebearings, because some (old) renderers get into trouble if the widths differ between cursive attachment (the distance between exit and entry anchors) and the actual glyph width. So our dotless beh may end up looking like this:

See, exit is at x=0, y=0, and entry exactly on the right sidebearing, together with the bottom right node. And since we have been using this glyph as a component in the medial variants of beh, teh, noon, yeh, peh, etc., the changes shine through immediately.

Done, right? Well not quite. Since entry is at an unusual position, we need to at least add exit anchors to all glyphs that may connect in that spot. That means all initial and medial glyphs. Sounds like a lot of work. Luckily, there is a way to automate it. Read on.

Useful scripts

In Window > Plugin Manager > Scripts, you can install the mekkablue scripts. They contain a couple of functions you may find useful.

  • mekkablue > App > Toggle LTR/RTL: switches from LTR to RTL and vice versa, useful for setting a keyboard shortcut in Glyphs > Preferences > Shortcuts, so you do not have to mouse down to the bottom edge of the window every time.
  • mekkablue > Paths > Position Clicker: you pick a reference medial glyph (by default behDotless-ar.medi), and the script will test it with every other positional glyph, and see if at least two nodes ‘click’, i.e., snuggly align on top of each other where the connecting strokes come together. It will report letter combinations that do not click as they are supposed to.

    Hint: all options in the window have tooltips that display when you mouse over them.

  • mekkablue > Font Info > Vertical Metrics Manager: make sure you turn on the option Include mark-to-base offset for OS/2 usWin, because otherwise the usWin value may be too low. Vowel marks that do not fit under usWin when they attach to base letters may appear clipped in Office apps.

    Hint: all those buttons, entry fields and checkboxes have mouseover tooltips that will help you understand what is going on.

  • mekkablue > Anchors > Fix Arabic Anchor Ordering in Ligatures: if you have multiple top anchors for the various characters in your ligatures, named top_1, top_2, etc., but they appear to be in the wrong order (should be LTR instead of RTL), this script fixes this by renumbering all ligature anchors from right to left. A wrong order can be the result of a conversion error or faulty implementations in third-party software.
  • mekkablue > Anchors > Insert exit and entry Anchors for Selected Positional Glyphs: does what it says, will insert exit and entry anchors for cursive attachment in all selected medial, initial and final glyphs. Will try to guess an appropriate position by measuring the glyph at it sidebearings.
  • mekkablue > Glyph Names, Notes and Unicodes > Encoding Converter: converts legacy encodings to modern Unicode, and the default is a conversion scheme for old AXt fonts. AXt was a hack to make Arabic work in old QuarkXPress versions that were confined to the very limited 8-bit MacRoman encoding in the good old Latin-centric days.

    Hint: if you mouse over… yeah, right, tooltips. You know that already.

Whoa that was a lot, but it wasn’t that difficult, was it. Have fun experimenting with Arabic letters.


SAMPLE FONT: Makdessi by Nadine Chahine, also used as reference for workflow reconstructions.

Update 2012-10-07: removed a superfluous paragraph.
Update 2016-02-19: Updated screenshots for Glyphs 2.
Update 2017-09-08: Replaced one faulty screenshot.
Update 2020-03-25: Changed title.
Update 2020-04-08: Added chapter about ligatures.
Update 2021-01-03: Completely rewritten and updated for Glyphs 3, new sample font, courtesy of Nadine Chahine.
Update 2021-01-22: Added the words ‘selected glyphs’ in the first section.
Update 2021-02-08: Corrected a few typos.
Update 2021-03-10: Added the 90° rotation in the cap section.