Using Contextual alternates as Required Ligatures

My question was that I need to use the Calt as required not as a contextual and Rainer said it is possible to use the calt in rlig and should work, but as soon as I pasted them in rlig errors popped up and I am not sure what the problem is.

I removed them and left them back in calt and now those won’t export either (error missing ‘=’) not sure where it is needed.

When they were in calt they weren’t working anyways once exported.

Any advice is much appreciated

Hello Najla! It’s hard to tell from this screenshot alone (it doesn’t look like the entire code of the rlig feature). Can you post it again if it’s not like hundreds of lines? Otherwise, maybe attach it as a text file?

Hi @Tosche, this is the contextual alternate code not the rlig, i took this code over to the rlig and it didnt work. The calt doesnt have a start code like the rlig, but either way the error starts when I take it there. Should there be an additional code to it?

PS the code just continues like it s this way but repetitive according to the similar forms.

The issue is somewhere in your code, and you may not know where that is until you show it in full. Would you mind showing it in private?

@Tosche Here it is
My second question is do I just cut/copy paste it to the rlig with no intros or anything?

sub beh-ar.init' tah-ar.medi by beh-ar.init.ss01;
sub beh-ar.init' zah-ar.medi by beh-ar.init.ss01;
sub beh-ar.init' sad-ar.medi by beh-ar.init.ss01;
sub beh-ar.init' dad-ar.medi by beh-ar.init.ss01;
sub teh-ar.init' tah-ar.medi by teh-ar.init.ss01;
sub teh-ar.init' zah-ar.medi by teh-ar.init.ss01;
sub teh-ar.init' sad-ar.medi by teh-ar.init.ss01;
sub teh-ar.init' dad-ar.medi by teh-ar.init.ss01;
sub theh-ar.init' tah-ar.medi by theh-ar.init.ss01;
sub theh-ar.init' zah-ar.medi by theh-ar.init.ss01;
sub theh-ar.init' sad-ar.medi by theh-ar.init.ss01;
sub theh-ar.init' dad-ar.medi by theh-ar.init.ss01;
sub yeh-ar.init' tah-ar.medi by yeh-ar.init.ss01;
sub yeh-ar.init' zah-ar.medi by yeh-ar.init.ss01;
sub veh-ar.init' sad-ar.medi by yeh-ar.init.ss01;
sub yeh-ar.init' dad-ar.medi by yeh-ar.init.ss01;
sub noon-ar.init' tah-ar.medi by noon-ar.init.ss01;
sub noon-ar.init' zah-ar.medi by noon-ar.init.ss01;
sub noon-ar.init' sad-ar.medi by noon-ar.init.ss01;
sub noon-ar.init' dad-ar.medi by noon-ar.init.ss01;
sub yehHamzaabove-ar.init' tah-ar.medi by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' zah-ar.medi by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' sad-ar.medi by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' dad-ar.medi by yehHamzaabove-ar.init.ss01;
sub beh-ar.init' tah-ar. fina by beh-ar.init.ss01;
sub beh-ar.init' zah-ar.fina by beh-ar.init.ss01;
sub beh-ar.init' sad-ar. fina by beh-ar.init.ss01;
sub beh-ar.init' dad-ar. fina by beh-ar.init.ss01;
sub teh-ar.init' tah-ar.fina by teh-ar.init.ss01;
sub teh-ar.init' zah-ar.fina by teh-ar.init.ss01;
sub teh-ar.init' sad-ar.fina by teh-ar.init.ss01;
sub teh-ar.init' dad-ar. fina by teh-ar.init.ss01;
sub theh-ar.init' tah-ar.fina by theh-ar.init.ss01;
sub theh-ar.init' zah-ar.fina by theh-ar.init.ss01;
sub theh-ar.init' sad-ar.fina by theh-ar.init.ss01;
sub theh-ar.init' dad-ar.fina by theh-ar.init.ss01;
sub yeh-ar.init' tah-ar. fina by yeh-ar.init.ss01;
sub yeh-ar.init' zah-ar.fina by yeh-ar.init.ss01;
sub yeh-ar.init' sad-ar.fina by yeh-ar.init.ss01;
sub yeh-ar.init' dad-ar. fina by yeh-ar.init.ss01;
sub noon-ar.init' tah-ar.fina by noon-ar.init.ss01;
sub noon-ar.init' zah-ar.fina by noon-ar.init.ss01;
sub noon-ar.init' sad-ar.fina by noon-ar.init.ss01:
sub noon-ar.init' dad-ar.fina by noon-ar.init.ss01;
sub yehHamzaabove-ar.init' tah-ar.fina by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' zah-ar.fina by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' sad-ar.fina by yehHamzaabove-ar.init.ss01;
sub beh-ar.init' ain-ar.medi.ss01 by beh-ar.init.ss01;
sub beh-ar.init' ghain-ar.medi by beh-ar.init.ss01;
sub beh-ar.init' ghain-ar.medi.ss01 by beh-ar.init.ss01;
sub teh-ar.init' ain-ar.medi by teh-ar.init.ss01;
sub teh-ar.init' ain-ar.medi.ss01 by teh-ar.init.ss01;
sub teh-ar.init' ghain-ar.medi by teh-ar.init.ss01;
sub teh-ar.init' ghain-ar.medi.ss01 by teh-ar.init.ss01;
sub theh-ar.init' ain-ar.medi by theh-ar.init.ss01;
sub theh-ar.init' ain-ar.medi.ss01 by theh-ar.init.ss01;
sub theh-ar.init' ghain-ar.medi by theh-ar.init.ss01;
sub theh-ar.init' ghain-ar.medi.ss01 by theh-ar.init.ss01;
sub yeh-ar.init' ain-ar.medi by yeh-ar.init.ss01;
sub yeh-ar.init' ain-ar.medi.ss01 by yeh-ar. init.ss01;
sub yeh-ar.init' ghain-ar.medi by yeh-ar.init.ss01;
sub yeh-ar.init' ghain-ar.medi.ss01 by yeh-ar.init.ss01;
sub noon-ar.init' ain-ar.medi by noon-ar.init.ss01;
sub noon-ar.init' ain-ar.medi.ss01 by noon-ar.init.ss01;
sub noon-ar.init' ghain-ar.medi by noon-ar.init.ss01;
sub noon-ar.init' ghain-ar.medi.ss01 by noon-ar.init.ss01;
sub yehHamzaabove-ar.init' ain-ar.medi by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init ain-ar.medi.ss01 by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ghain-ar.medi by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ghain-ar.medi.ss01 by yehHamzaabove-ar.init.ss01;
sub beh-ar.init' ain-ar. fina by beh-ar.init.ss01;
sub beh-ar.init' ain-ar.fina.ss01 by beh-ar.init.ss01;
sub beh-ar.init' ain-ar.fina.ss02 by beh-ar.init.ss01:
sub beh-ar.init' ain-ar. fina.ss03 by beh-ar.init.ss01;
sub teh-ar.init' ain-ar.fina by teh-ar.init.ss01;
sub teh-ar.init' ain-ar.fina.ss01 by teh-ar.init.ss01;
sub teh-ar.init' ain-ar.fina.ss02 by teh-ar.init.ss01;
sub teh-ar.init' ain-ar.fina.ss03 by teh-ar.init.ss01:
sub theh-ar.init' ain-ar.fina by theh-ar.init.ss01;
sub theh-ar.init' ain-ar.fina.ss01 by theh-ar.init.ss01;
sub theh-ar.init' ain-ar.fina.ss02 by theh-ar.init.ss01;
sub theh-ar.init' ain-ar.fina.ss03 by theh-ar.init.ss01;
sub yeh-ar.init' ain-ar.fina by yeh-ar.init.ss01:
sub yeh-ar.init' ain-ar. fina.ss01 by yeh-ar.init.ss01;
sub yeh-ar.init' ain-ar.fina.ss02 by yeh-ar.init.ss01;
sub yeh-ar.init' ain-ar.fina.ss03 by yeh-ar.init.ss01;
sub noon-ar.init' ain-ar.fina by noon-ar.init.ss01;
sub noon-ar.init' ain-ar.fina.ss01 by noon-ar.init.ss01;
sub noon-ar.init' ain-ar.fina.ss02 by noon-ar.init.ss01;
sub noon-ar.init' ain-ar.fina.ss03 by noon-ar.init.ss01;
sub yehHamzaabove-ar.init' ain-ar.fina by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ain-ar.fina.ss01 by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ain-ar.fina.ss02 by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ain-ar.fina.ss03 by yehHamzaabove-ar.init.ss01;
sub beh-ar.init' ghain-ar.fina by beh-ar.init.ss01;
sub beh-ar.init' ghain-ar.fina.ss01 by beh-ar.init.ss01;
sub beh-ar.init' ghain-ar.fina.ss02 bv beh-ar.init.ss01;
sub beh-ar.init' ghain-ar.fina.ss03 by beh-ar.init.ss01;
sub teh-ar.init' ghain-ar.fina by teh-ar.init.ss01;
sub teh-ar.init' ghain-ar.fina.ss01 by teh-ar.init.ss01;
sub teh-ar.init' ghain-ar.fina.ss02 by teh-ar.init.ss01;
sub teh-ar.init' ghain-ar.fina.ss03 by teh-ar.init.ss01;
sub theh-ar.init' ghain-ar.fina by theh-ar.init.ss01;
sub theh-ar.init' ghain-ar.fina.ss01 by theh-ar.init.ss01;
sub theh-ar.init' ghain-ar.fina.ss02 by theh-ar.init.ss01;
sub theh-ar.init' ghain-ar. fina.ss03 by theh-ar.init.ss01;
sub yeh-ar.init' ghain-ar.fina by yeh-ar.init.ss01;
sub yeh-ar.init' ghain-ar.fina.ss01 by yeh-ar.init.ss01;
sub yeh-ar.init' ghain-ar.fina.ss02 by yeh-ar.init.ss01;
sub veh-ar.init' ghain-ar.fina.ss03 by yeh-ar.init.ss01;
sub noon-ar.init' ghain-ar.fina by noon-ar.init.ss01;
sub noon-ar.init' ghain-ar.fina.ss01 by noon-ar.init.ss01;
sub noon-ar.init' ghain-ar.fina.ss02 by noon-ar.init.ss01;
sub noon-ar.init' ghain-ar. fina.ss03 by noon-ar.init.ss01;
sub yehHamzaabove-ar. init' ghain-ar.fina by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ghain-ar.fina.ss01 by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ghain-ar.fina.ss02 by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' ghain-ar. fina.ss03 by yehHamzaabove-ar.init.ss01;
sub seen-ar.init.ss02 hah-ar.fina' by hah-ar.fina.ss01;
sub sheen-ar.init.ss02 hah-ar. fina' by hah-ar.fina.ss01;
sub seen-ar.init.ss02 khah-ar.fina' by khah-ar.fina.ss01;
sub sheen-ar.init.ss02 khah-ar.fina' by khah-ar.fina.ss01;
sub seen-ar.init.ss02 jeem-ar.fina' by jeem-ar.fina;
sub sheen-ar.init.ss02 jeem-ar.fina' by jeem-ar.fina.ss01;
sub seen-ar.init' reh-ar.fina by seen-ar.init.ss02;
sub sheen-ar.init' reh-ar.fina by sheen-ar.init.ss02;
sub seen-ar.init' zain-ar.fina by seen-ar.init.ss02;
sub sheen-ar.init' zain-ar.fina by sheen-ar.init.ss02;
sub seen-ar.init' reh-ar.fina.ss01 by seen-ar.init.ss02;
sub sheen-ar.init' reh-ar.fina.ss01 by sheen-ar.init.ss02;
sub seen-ar.init' zain-ar.fina.ss01 by seen-ar.init.ss02;
sub sheen-ar.init' zain-ar.fina.ss01 by sheen-ar.init.ss02:
sub sad-ar.init.ss02 hah-ar.fina' by hah-ar.fina.ss01;
sub dad-ar.init.ss02 hah-ar.fina' by hah-ar.fina.ss01;
sub sad-ar.init.ss02 khah-ar.fina' by khah-ar.fina.ss01;
sub dad-ar.init.ss02 khah-ar.fina' by khah-ar.fina.ss01;
sub sad-ar.init.ss02 jeem-ar.fina' by jeem-ar.fina.ss01;
sub dad-ar.init.ss02 jeem-ar.fina' by jeem-ar.fina.ss01
sub beh-ar.init' jeem-ar.medi by beh-ar.init.ss01;
sub beh-ar.init' hah-ar.medi by beh-ar.init.ss01;
sub beh-ar.init' khah-ar.medi by beh-ar.init.ss01;
sub teh-ar.init' jeem-ar.medi by teh-ar.init.ss01;
sub teh-ar.init' hah-ar.medi by teh-ar.init.ss01;
sub teh-ar.init' khah-ar.medi by teh-ar.init.ss01;
sub theh-ar.init' jeem-ar.medi by theh-ar.init.ss01;
sub theh-ar.init' hah-ar.medi by theh-ar.init.ss01;
sub theh-ar.init' khah-ar.medi by theh-ar.init.ss01;
sub yeh-ar.init' jeem-ar.medi by yeh-ar.init.ss01;
sub yeh-ar.init' hah-ar.medi by yeh-ar.init.ss01;
sub yeh-ar.init' khah-ar.medi by yeh-ar.init.ss01;
sub noon-ar.init' jeem-ar.medi by noon-ar.init.ss01;
sub noon-ar.init' hah-ar.medi by noon-ar.init.ss01;
sub noon-ar.init' khah-ar.medi by noon-ar.init.ss01;
sub yehHamzaabove-ar.init' jeem-ar.medi by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' hah-ar.medi by yehHamzaabove-ar.init.ss01;
sub yehHamzaabove-ar.init' khah-ar.medi by yehHamzaabove-ar.init.ss01;

Your code looks fine. You should be able to paste it into the rlig feature to have it always active without giving the font user the option to turn the feature off.

In case you still get an error, could you post a screenshot of the error message?

@FlorianPircher Okay so the error that had occured was reolved when I removed my attempt at making classes to make all this simpler.

but here is the error that occurs when I paste it in rlig:

The lines above the screenshot are not compatible with the lines below. Can you show the lines above the error lines? I suspect they do not have a quote mark (').

Okay so I think I resolved it, I was pasting it inside the code of the rlig (lookup rlig arab) and when I pasted it outside of that no errors and it is finally working fine.

Sorry for the hassle!

And thank you @Tosche and @FlorianPircher !

Ah yes, putting the code in the exiting lookup would yield an error. The regular rlig substitution is a multiple-to-one case, whereas the calt code with quotes is a different type. They cannot sit in the same block of codes (i.e. lookups), and you need to separate them, which is presumably how you’ve resolved.

1 Like

@Tosche Yes, I usually avoid doing this but the font needed so many ligatures and solutions that I needed a different solution, with Arabic many people just make more ligatures to resolve it which was getting out of hand for this style.

Thanks for the support!

You can simplify the rules further by grouping the glyphs. The first eight lines could be simplified to one like this:

sub [beh-ar.init teh-ar.init]' [tah-ar.medi zah-ar.medi sad-ar.medi dad-ar.medi] by [beh-ar.init.ss01 teh-ar.init.ss01];

In the groups you’re substituting (the beh and teh groups), the order of the glyph names matter in before and after. If you are using the same group a lot, you can give it a name and recycle it:

@tahs = [tah-ar.medi zah-ar.medi sad-ar.medi dad-ar.medi];
sub [beh-ar.init teh-ar.init]' @tahs by [beh-ar.init.ss01 teh-ar.init.ss01];

The second example does exactly the same thing as the first, but @tahs can be used again later.

1 Like

@Tosche so even if its more than these two letters? (its beh teh the yeh noon and yeh hamza above) so if this works it just needs the same sequence they are in so it replaces correctly?

Also @tahs would be in the classes? or where? each class is named like that or within the class I write @tahs bla bla

Thank you it will make my life easier to do this

I think it’s worth grouping even if they are only two glyphs, and if grouping result in fewer lines. If the same group (i.e. class) appears multiple times, it’s worth giving it a name.

The @tahs in my example is directly written in the code. Glyphs’s interface has a dedicated section for Classes above Features where you can alternatively put there. If you do that, you can use it in multiple features (in this case, that’s what you may want since you have rlig and calt).

2 Likes