Can Glyphs generate multiple ligatures through a single command?

Hi everyone, and Happy New Year to you all.
I’m new to Glyphs and to Arabic type design. Currently, I’m working on designing an Arabic typeface based on a traditional Moroccan script. However, unlike standard Arabic, sometimes this script requires certain letters to sit on top of each other to give it its intricate and beautiful look; unfortunately it affects other letters’ positioning, too. For example, whichever letters come before “hah, jeem, or khah, either medial or final” have to look like in the following example:

From right to left, here are the glyphs used in this word: alef-ar, lamInit, khahMedi, yehMedi, and finally rehFina.
(Notice how high the lamInit is from the baseline, and how it is connected to the khahMedi.)
Also, in order to keep the lamInit from extending above the capHeight, I had to create a ligature, otherwise it would have looked like this, instead.

The ligatures seem to work fine, but I must say it’s cumbersome and time-consuming; and I don’t imagine myself going through every combination possible. So, my question is:
Is there a way to write a syntax or something which tells Glyphs that no matter how many characters fall between lamInit and jeemMedi, for example, lamInit should always take its new form and shouldn’t go beyond the capHeight?
I’ll be very grateful if anyone of you help me solve this problem, and turn words like these from looking like this

into looking like this, instead, without creating a specific ligature for each of them, as I did in this case.

Thank you very much.

The stacking of glyphs can be done with ‘cursive attachment’. It is (a bit simplified) explained in the Arabic tutorial: https://glyphsapp.com/learn/arabic
With the correct placement of the entry and exit anchors, the preceding glyph moves up and/or above the next glyph. So no need to build all kinds of ligatures.

@GeorgSeifert Thank you very much for replying back. I think there was a misunderstanding.
Actually I’ve been using Cursive Attachment all along, and it works like a charm; however that’s not the issue here. I’ll try to be a lot clearer.
Let’s say we have a four-letter word, such as الحب (alef-ar, lam-ar.init, hah-ar.medi, beh-ar.fina). In this case, the lamInit is supposed to stack up above hahMedi; and the end result would look something like this (without any discretionary ligature applied):

Unfortunately in my design, the lamInit shouldn’t extend above the ascender; I wanted it to be aligned in height to the alefIsol. So, I had to create a ligature where the lamInit is shorter. And this is how it should look:

But again the moment you add any letter between the lamInit and hahMedi, the chain is broken and the lamInit goes back to its original form; thus extending above the ascender again. (Like in the following example when I added meemMedi between the two)

So, do you think there’s a way to tell Glyphs that anytime a letter (or any number of letters, for instance) comes between lamInit and hahMedi, use the shorter version of lamInit, instead?
I’m also not a coder yet, but I truly believe that there must be some sort of expressions or lines of codes where “if…” “then…” are in control.

I really appreciate your help. Thank you.

1 Like

That can be done by contextual substitutions.

So you make a class with all .medi glyphs, one with all shorter glyphs and one that has the normal glyph matching the shorter ones. (I didn’t test this but it should give you an idea on how to get it to work. If you don’t this, I recommend that you read the tutorials about Feature code: https://glyphsapp.com/learn?q=opentype+features)

@medi = [all .medi glyphs]
@short = [alef-ar.init.short lam-ar.init.short lam-ar.medi.short]
@normal = [alef-ar.init lam-ar.init lam-ar.medi]
@hah = [hah-ar.medi hah-ar.fina]
sub @normal' @medi @medi @medi @medi @medi @medi @hah by @short;
sub @normal' @medi @medi @medi @medi @medi @hah by @short;
sub @normal' @medi @medi @medi @medi @hah by @short;
sub @normal' @medi @medi @medi @hah by @short;
sub @normal' @medi @medi @hah by @short;
sub @normal' @medi @hah by @short;
sub @normal' @hah by @short;
1 Like

I was going to recommend exactly the same, and this is basically what I did in my Qahiri font.

The drawback is that any longer word will get the full length lam, but it is nit an issue in practice since there are no such very long words in Arabic and even is there are the full length lam is still readable even if aesthetically less ideal.

I think a more bullet-proof solution can be done with reverse chaining substitutions, but it will require having a duplicate copy of all medial glyphs which is not worth it.

1 Like

Bullet-proof as in works for arbitrary length words or as in works most reliably? Last time I wanted to use reverse chaining substitutions practically no software supported it.

The former.

Reverse chaining substitutions are supported by HarfBuzz, Uniscribe/DirectWrite and CoreText, which is all I’d care about.

1 Like

Bonjour
Pour moi (désigner, nul en code!), la solution est de désactiver, la fonction : Générer la fonction automatiquement dans dlig et d’ajouter ce que veux. pour الحب j’ai créer (carrément) une ligature : sub alef-ar lam-ar.init hah-ar.medi beh-ar.fina by alef_lam_hah_beh-ar;
Comme le beh-ar.fina et le alef-ar sont les memes dans la police on peux s’arrêter à : sub lam-ar.init hah-ar.medi by lam_hah-ar.init;

1 Like

@GeorgSeifert, @khaled.
Thank you very much. I think that’ll solve the problem. I’ll try it in a couple of days after I’m done with an assignment, and I’ll keep you updated.
I really appreciate your help since I’m a newbie to Glyphs and to Arabic type design. I’ve only been doing this for a little more than two weeks, and I’m extremely pleased with the outcome. Besides some redesigning and tweaks, I’ve already tried my first Arabic/Moroccan typeface, and it’s working.
So again, many thanks to all of you for your help.

Bonjour!
J’ai fait exactement ce que vous avez proposé, mais ma question était en regard des lettres qui continuent à changer ente le lamInit et hahMedi.
Je ne voulais pas résoudre à créer des ligatures tout le temps. J’étais en recherche d’une façon facile qui produisent des ligatures automatiquement, comme dans le cas des classes.
Merci beaucoup pour votre aide; c’était trop gentil de votre part.