Creating a Devanagari font

Tutorial
by Kimya Gandhi & Rob Keller

29 July 2022 Published on 7 February 2018

Devanagari, used for languages such as Hindi, Marathi, Nepali, and many more, is the widest used script in India. While each designer might have their own workflow, this tutorial illustrates our recommended step-by-step process to build a Devanagari font by utilizing all of Glyphs’ cool features!

Setting up a Devanagari font file

When you create a new file in Glyphs (File > New, Cmd-N), it will open a window with Latin characters by default. There are two ways to add glyphs for Devanagari – one through Glyph > Add Glyphs (Cmd-Shift-G), or from the sidebar under the Languages > Devanagari section. Right-click on the subcategories inside Devanagari to see a list of glyphs included in each section then you can select the ones to add to the font:

You can see that all Devanagari glyphs have descriptive glyph names and a -deva suffix. This makes it possible for the app to determine the script of the glyph and automatically build the appropriate OpenType code later on.

The first step

Let's start with the most basic element of a Devanagari letter, the vertical stroke as found in aaMatra-deva. This defines the most basic proportions of our Devanagari letterforms, and it is used in most glyphs. So it would be great if we could design it once, and use it as a component in all the other glyphs needing it. You will find this character listed in the sidebar under Languages > Devanagari > Vowels. Or you can manually add it by typing Cmd-Shift-G, then, in the upcoming dialog, aaMatra-deva and pressing the Generate button.

You can also go ahead and add a value for the shoulder-line with the shoulderHeight custom parameter in File > Font Info > Masters (cmd-I). This will help the placement of anchors in not only the aaMatra-deva, but many other glyphs as well.

A note about spacing: Devanagari usually has a connecting headline, so you will probably want to extend the headline out slightly, so the sidebearings have negative values. You can define a standard value here and it will apply to many glyphs later on as well. Don’t worry, if you change your mind later, it’s very easy to update everything at once.

Setting anchors

It is never too early to start thinking about anchors. Most vowel and intonation marks will align in the same place relative to the vertical stem, so we can simply add anchors to the aaMatra-deva and they will be automatically copied to any glyph using this as a component. With the shoulderHeight defined, you only need to run Glyph > Set Anchors (Cmd-U), and the anchors will be automatically added at the correct vertical height. You may need to move them horizontally depending on your design.

Building composites from half-consonants and half-forms

Now we can prepare the components needed for the consonants. Most of the consonants are constructed with a half-form connected to the aaMatra-deva. These half-forms are not only used to form the full consonants, but also to build conjuncts – the ligatures of two or more consonants where the inherent vowel aaMatra-deva has been deleted (e.g. ‘pepper’ = पेप्पर). More about conjuncts later, let’s first design the p-deva, which is the half-form of pa-deva. You may now want to go ahead and add the half-forms from the aptly named Halfform section in the sidebar.

To create the full consonant pa-deva, we can generate that glyph (via Glyph > Add Glyphs…, Cmd-Shift-G), then add the p-deva and aaMatra-deva as components by choosing Glyph > Add Component (Cmd-Shift-C) for both of them. If you are not happy with the alignment, you can just adjust the right sidebearing of the p-deva to look good next to an aaMatra-deva, then the pa-deva should automatically match perfectly.

Using this approach, we can design much of the basic Devanagari consonants. Let’s go ahead and add some more in the same way:

Completing the basic consonants

You will notice that not all consonants can be built from half-forms, e.g., glyphs like ka-deva, pha-deva, and ha-deva. These will need custom designed full forms. In cases like this, we generally draw the full forms first, then use those as the basis for their half forms.

There is also a small set of hanging consonants that do not have normal half-forms: tta-deva ttha-deva dda-deva ddha-deva da-deva nga-deva. Instead of turning into a half-form, they receive a ‘halant’ at the bottom (also referred to as ‘virama’). In other words, now may be a good time to draw the halant-deva glyph. Find it in the sidebar under Languages > Devanagari > Marks. Do not forget to hit Cmd-U to give the halant an anchor.

Once you have the hanging consonants and the halant in your font, you can create the remaining consonants: Choose Glyph > Add Glyphs… and paste this:

tt-deva tth-deva dd-deva ddh-deva d-deva ng-deva

Then press Generate. I.e., the same glyph names, but without the a at the end. Glyphs is smart enough to create them right away as compounds of the respective hanging consonant and the halant.

Spacing consonants and kerning groups

We can start spacing our glyphs by switching to the Text tool (T) in an Edit view. Let’s space the tta-deva next to an aaMatra-deva:

We can go ahead and define the right kerning group for all the consonants using aaMatra-deva at this stage. As for the left groups, you can identify similar left side shapes and define those as well; be sure to also do it for the half-forms.

Conjuncts

Conjuncts are another important element needed to correctly render the Devanagari script. The way you choose to form these will vary depending on your design. Generally, most can be written horizontally/linearly, as a combination of a half-form and full consonant. Others occur either vertically stacked or combined into a more complex letterform – these are referred to as ‘akhand conjuncts’.

In this comparison, you can see how some linear conjuncts are built with default half-forms, and then, their modified, custom versions to make nicer clusters:

If one considers any two, three, four or more consonant combinations, there can be thousands of combinations. Sanskrit requires many conjuncts – and many of them are of the akhand variety. But Hindi, Marathi and other modern languages use conjuncts less frequently. So if one were to support advanced Sanskrit, the number of akhand conjuncts to be designed could easily be a few thousand. Hence, the function of the font will decide the character set. If you are looking to support modern Hindi, Marathi, Sindhi, Nepali, etc., the number of conjuncts required could be considerably less.

Instead of designing all the thousands of possible combinations, Glyphs allows for the linear conjuncts to be automatically composed from the half-forms and full-forms we designed earlier. It will be up to the style and requirements of your design to decide which, or how many, linear conjuncts you will custom-design. In some cases you may need very few, other times you may need lots. There is no easy way around it, you will need to test all the combinations to see which look good by default and which should have custom linear conjuncts.

Generating OpenType features

As alluded to earlier, Devanagari requires a lot of complicated OpenType code to get it to render correctly. Fear not, Glyphs can generate it all automatically! Open File > Font Info > Features (Cmd-I). Now just press the Update button and Glyphs will write all the OpenType code needed to preview what you have so far.

If you haven’t noticed already, in the Edit view you can insert any character by pressing Cmd-F. Try inserting a consonant, a halant, and another a consonant. Now look in the lower left corner of the Edit view, and click the Features button: The features and languages your typeface supports are now listed under their scripts. Select Devanagari to see the OpenType code in action:

Different forms for ra-deva

Now let’s move on to the shapeshifting letter Ra. In Devanagari, the Ra can take on four different forms depending on its context. If it is first in a cluster, it becomes a Reph, and is placed over the vertical stem of the last full-form consonant in the cluster.

If the Ra is placed after consonants with a vertical stroke, it will turn into a ‘leg’, attached to the vertical stem of the preceding consonant:

But wait, there’s more. If the Ra combines with a consonant without a vertical stroke, it becomes a Rakar. This applies primarily to tta_ra-deva ttha_ra-deva dda_ra-deva ddha_ra-deva cha_ra-deva:

But wait, there’s even more! In Marathi, the Ra can also take on the form of an ‘eyelash’:

Phew! Let’s quickly recap these variations.

The Reph and the Rakar are easy. Just create reph-deva and rakar-deva, draw your shapes, and place the anchors with Cmd-U. By the way, both reph-deva and rakar-deva are in the sidebar under Languages > Devanagari > Marks.

The ‘leg’ form conjuncts takes a bit more effort. Let’s first design rakar-deva.leg (note the dot suffix .leg) to use as a component. This one is not in the sidebar, so just create it manually with Glyph > Add Glyphs… (Cmd-Shift-G). Once we have done that, we can place a _leg anchor in it: right-click in the canvas, choose Add Anchor from the context menu, then type the anchor name:

This leg form of Ra can also appear in the middle of clusters. For that, we should also design ‘half-conjuncts’. Such a concept does not exactly exist in Devanagari, but by utilizing these new glyphs as components, we can dynamically create numerous custom looking conjuncts – without actually having to design every conceivable permutation individually.

To have the rakar-deva.leg automatically connect to the consonants, we should place a leg anchor on all the half-consonants. This way, they will show up as a combination with the half-forms as well as the full-forms. You can then generate the conjuncts from the sidebar, or with Glyph > Add Glyphs… (Cmd-Shift-G) and manually typing names. But pay attention because correct naming of these conjuncts is essential for Glyphs to construct the compounds and automatically generate the OpenType feature code.

It’s important to note that the nomenclature of Ra conjuncts is slightly different from the other conjuncts. Name the conjuncts the way they look. In the case of the text pa-deva halant-deva ra-deva we see a pa-deva with a Ra (the Ra has the form of a leg, but it is a Ra none the less). Therefore we call the conjunct pa_ra-deva. Once you make the conjunct glyphs using the anchor, you might want to change the position and angle of the leg depending on the consonant it appears with. In some cases, you may have to decompose the components to ensure that the leg does not clash with the consonant.

Let’s make the ‘half-conjunct’ for pa-deva halant-deva ra-deva halant-deva. Following the visual-appearance model of naming, our new glyph should be named p_ra-deva:

Creating half-conjuncts will speed up the generating of the full-form akhand conjuncts. And it will allow for more dynamic building of complex linear conjuncts, like this fake one:

Nukta

This is working great so far but what about the Nukta (nukta-deva)? Begin by drawing this little dot, or using another existing dot as a component. Then hit Cmd-U to add the appropriate anchor.

Luckily for us, anchors found inside components will get used, they ‘shine through’. This usually saves a lot of work (just think about the aaMatra-deva). But sometimes the anchor position in a component will cause problems with more complicated conjuncts. Then you can override the anchor by placing an anchor with the same name in the compound.

Now let’s look at this p_ra-deva that we just made. In cases like these, we can avoid this overlap by adding a nukta anchor in the p_ra-deva glyph. Now anytime you use this component, the new anchor will always override the nukta that shines through from the p-deva:

Creating vowel marks

Devanagari vowel marks, or ‘matras’, are forms of vowels that appear in combination with consonants and conjuncts. Most will be positioned automatically with the help of top and bottom anchors. We took care of this already when we created the stem anchor at the beginning:

Just like with the nukta anchor, you should check each glyph and the vowel positions, because on certain combinations, they will need to be adjusted.

iMatra-deva

The i matras are another exception to the rule. They need their own special imatra anchor to work properly. (Hint: iiMatra-deva gets an iimatra anchor.) Depending on your design, you might choose to create any number of iMatra-deva length variations. The iMatra-deva glyph should extend to connect with the vertical stem of the modified letter, and this can vary significantly because of the numerous conjunct possibilities. But this is also a stylistic decision, so you may want more or fewer options.

Create as many iMatra-deva variants with number suffixes as you feel necessary: iMatra-deva.001 iMatra-deva.002 iMatra-deva.003, etc., and give each of them an imatra anchor (Cmd-U). Glyphs will use these anchors to calculate which iMatra-deva variant is best fitting to your top anchors in your main consonants and conjuncts when it is generating the OpenType code. To check on the result, see the pres feature in File > Font Info > Features.

So, that is an overview of our recommendations for developing Devanagari fonts. Gone are the days of being overwhelmed by complicated OT coding, you can now just focus on making beautiful typefaces and let Glyphs do the heavy lifting in production.


Guest tutorial by Kimya Gandhi and Rob Keller (Mota Italic, Mumbai).
SAMPLE FONT: VESPER DEVANAGARI BY MOTA ITALIC

Update 2020-11-13: Glyphs 3 website updates.
Update 2022-07-29: updated title, related articles, minor formatting.