Ligatures not working in Arabic

Hi everyone,

I’m working on a project where I want to create custom ligatures for arabic. After some experimentation i’ve managed to make the first ligature activate by specifying the unicode features init, medi & fina for the chosen word.

sub uni062C uni0627.fina uni062C.medi uni062A.medi uni062D.init uni0627 by uni062C0627062C062A062D0627.liga;

This worked for the first ligature, however, any subsequent ligature i try to add to this code is not recognised and specified text stays the same.

Full code:

lookupflag RightToLeft;
	sub uni062C uni0627.fina uni062C.medi uni062A.medi uni062D.init uni0627 by uni062C0627062C062A062D0627.liga;
	sub uni0645.init uni0646.medi uni0627.fina uni0636.init uni0644.fina by uni06450646062706360644.liga;
	sub uni0639.fina uni0641.init uni0627 uni062F.fina uni0645.init by uni063906410627062F0645.liga;

Any tips or leads are appreciated!

How are you testing?

Hey! I’ve tested this both in glyphs selecting the liga features and externally in photoshop.

I believe the problem lies with the identification of the word. That the script I wrote somehow does not represent the word that is being typed in Arabic.

" مناضل " is recognised with these parameters “uni0645.init uni0646.medi uni0627.fina uni0636.init uni0644.fina” and replaced with the ligature “uni06450646062706360644.liga”

However, the second word, " مدافع " , which I gave the parameters " uni0639.fina uni0641.init uni0627 uni062F.fina uni0645.init " Is not replaced with the ligature " uni063906410627062F0645.liga "

Is there an alternative way to call up a ligature that does not require the specification of “medi, fina & init”? It works without these parameters in Latin and Cyclic languages.

How did you get the font into Photoshop? Are you using the Adobe Fonts folder?

  1. why are you using uniXXXX names? You can use human-readable names within Glyphs.
  2. yes, if you place the ligature feature after the positional features, you need to reference the respective positional shapes.

The font I’m editing uses Unicode as an identifier for each Arabic glyph.

  1. For example, “qāf” which stands for ’ ق ’ isn’t recognised in feature references, it only recognises with “uni0642”. Please correct me if i’m wrong or there is a different way!

  2. Thought so makes total sense!

  3. I’ve tried it through adobe folder, still no success :frowning:

Thanks for your feedback up till now! It’s led to a few interesting approaches but nothing i’ve tried so far has resulted in any success.

I’m resolving this thread! Problem found. Because the script needs to be read Right to Left the uni names also need to be ordered the other way around, which for some reason was already the case for the working ligature. Gotta love working with Unicode!!

You can uncheck the “Use custom naming” in Font Info > Others. Then select all glyphs in font view and run “Glyph” > “Update Glyph Info”. That will convert all names to “nice” names.

Then, you can nane the ligatures: “meem_dal_alef_feh_ain-ar”. And Glyphs will write the feature code for you. In this case the code will do to the “dlig” feature. But you can add the name of the feature you like it to go like this: “meem_dal_alef_feh_ain-ar.rlig” to put it into the “rlig” feature. (just “.liga” doesn’t seem to work right now. I’ll fix this).

And to debug such feature code, I find it useful to use FontGoggles as it shows the names of the resulting glyphs.

To do this, you need to put the ligature in a feature that get applied before init/medi/fina features, typically ccmp feature. Note that this can result in the wrong ligature, for example if you have ligature for مدافع a word like مدافعنا will get the ligature followed by the glyphs for نا which might not be what you want.