Features for Arabic

Would you please let me know what is the problem
i had a colliding problem so i added an extension for some glyphs; they work perfect even with marks but they don’t on mark2mark
here is the screenshot and the code.

lookup calt5 {
lookupflag RightToLeft;
sub [ @teh_init_medi ] [ rehHahabove-ar rehDadabove-ar yehbelow-ar sadabove-ar ainabove-ar takhallusabove-ar tahabove-ar tahcenter-ar tahbelow-ar alefLamYehabove-ar zainabove-ar wasla-ar wavyhamzaabove-ar wavyhamzabelow-ar alefabove-ar alefbelow-ar hamzaabove-ar hamzaabove_fathatan-ar hamzaabove_dammatan-ar hamzaabove_fatha-ar hamzaabove_damma-ar hamzaabove_sukun-ar hamzabelow-ar hamzabelow_kasratan-ar hamzabelow_kasra-ar hamzacenter-ar fathatan-ar dammatan-ar kasratan-ar fatha-ar damma-ar kasra-ar shadda-ar sukun-ar shaddaAlefabove-ar shaddaDamma-ar shaddaDammatan-ar shaddaFatha-ar shaddaFathatan-ar shaddaKasra-ar shaddaKasratan-ar noonghunnaabove-ar fathaHorizont-ar dotvowelbelow-ar dammareversed-ar fathatwodots-ar sadLamAlefMaksuraabove-ar qafLamAlefMaksuraabove-ar meemabove-ar hahabove-ar seenbelow-ar maddalong-ar yehabove-ar noonabove-ar rhombusStopbelow-ar rhombusStopabove-ar dotStopabove-ar meembelow-ar fathaCurly-ar dammaCurly-ar kasraCurly-ar fathatanCurly-ar dammatanCurly-ar kasratanCurly-ar openfathatan-ar opendammatan-ar openkasratan-ar highwaw-ar fathaRing-ar fathaDotabove-ar kasraDotbelow-ar ] [ alef-ar.fina.short ]’ by [ alef-ar.alt ];
} calt5;

Try to add ‘IgnoreMarks’ to the lookupFlag.

Many Thanks!

Here is the result:
‘teh class’ it works perfect with ‘IgnoreMarks’
‘beh class’ it works with ‘RightToLeft’ but it doesn’t with ‘IgnoreMarks’ for mark2mark
i think the problem it comes from this feature which i need for ‘teh class’ and i don’t for ‘beh class’

lookup calt3 {
lookupflag IgnoreMarks RightToLeft;
sub @teh_init_medi alef-ar.fina’ by alef-ar.alt;
sub @teh_init_medi alef-ar.fina.short’ by alef-ar.alt;
sub @teh_init_medi alefHamzaabove-ar.fina’ by alefHamzaabove-ar.alt;
sub @teh_init_medi alefHamzabelow-ar.fina’ by alefHamzabelow-ar.alt;
sub @teh_init_medi alefWavyhamzaabove-ar.fina’ by alefWavyhamzaabove-ar.alt;
sub @teh_init_medi alefWavyhamzabelow-ar.fina’ by alefWavyhamzabelow-ar.alt;
sub @teh_init_medi alefMadda-ar.fina’ by alefMadda-ar.alt;
sub @teh_init_medi alefWasla-ar.fina’ by alefWasla-ar.alt;
sub @teh_init_medi alefFathatan-ar.fina’ by alefFathatan-ar.alt;
sub @teh_init_medi highhamzaAlef-ar.fina’ by highhamzaAlef-ar.alt;
sub @teh_init_medi alefTwoabove-ar.fina’ by alefTwoabove-ar.alt;
sub @teh_init_medi alefThreeabove-ar.fina’ by alefThreeabove-ar.alt;
} calt3;
Please let me know

The feature seems to be working, just the original position is wrong. Did you check the position of the top anchor in the base glyph?

I Checked
The problem it comes from “look up flag”
here is the situation:
I have a “alef-ar.fina” which would be replace by “alef-ar.alt” when it comes after "teh - theh, etc… (over all all the initial and medial “beh” shape’s family with dots above) and its works perfect; but i don’t need the “ale.alt” for beh - peh, etc… (over all all the initial and medial “beh” shape’s family with dots below) except when they have marks

Here is the problem: in No.2 i used “lookup flag RightToLeft” and it works but it breaks on mark 2 mark (no.3)
than i used “lookupflag IgnoreMarks RightToLeft” and it doesn’t work at all but “lookupflag IgnoreMarks RightToLeft” it work perfect on the second line (over all all the initial and medial “beh” shape’s family with dots above)

If I understand correctly, then:

In the teh case, you want the alternate alef whether or not there any marks on the teh. In this case use IgnoreMarks as you have shown for calt3.

In the beh case, you want the alternate alef if there is one or more marks on the beh, but not if there are no marks on the beh. In this case you cannot use IgnoreMarks, as the marks must be analysed to determine whether the alternate alef is needed.

But there needs to be a different rule to match the case of 1 mark, 2 marks, 3 marks, etc. So I think you will need something like:

lookupflag RightToLeft;
sub [ @teh_init_medi ] [ @marksAbove ] [ alef-ar.fina.short ]' by [ alef-ar.alt ]
sub [ @teh_init_medi ] [ @marksAbove ] [ @marksAbove ] [ alef-ar.fina.short ]' by [ alef-ar.alt ]
sub [ @teh_init_medi ] [ @marksAbove ] [ @marksAbove ] [ @marksAbove ] [ alef-ar.fina.short ]' by [ alef-ar.alt ]

(extend for however many marks you need to support)

Thanks Bob
Exactly but the problem is why “lookup flag RightToLeft” it breaks when i have more than one mark?
As you see it works perfect on no.2 but with the same flag (lookup flag RightToLeft) it doesn’t on no.3

I’m not sure what you mean by no.2 and no.3, but in any case: Could you post here the lookup that you think should work (that is, should replace the alef) when there are two marks?

I meant second and third word on the first line (no. 2 and no.3) from the picture
Here is the code
it works when i have one mark above “beh” but it doesn’t with two marks

lookup calt6 {
lookupflag RightToLeft;
sub @Beh_init_medi @Beh_init_medi_mark [ alef-ar.fina ]’ by alef-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alef-ar.fina.short ]’ by alef-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefHamzaabove-ar.fina ]’ by alefHamzaabove-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefHamzabelow-ar.fina ]’ by alefHamzabelow-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefWavyhamzaabove-ar.fina ]’ by alefWavyhamzaabove-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefWavyhamzabelow-ar.fina ]’ by alefWavyhamzabelow-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefMadda-ar.fina ]’ by alefMadda-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefWasla-ar.fina ]’ by alefWasla-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefFathatan-ar.fina ]’ by alefFathatan-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ highhamzaAlef-ar.fina ]’ by highhamzaAlef-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefTwoabove-ar.fina ]’ by alefTwoabove-ar.alt;
sub @Beh_init_medi @Beh_init_medi_mark [ alefThreeabove-ar.fina ]’ by alefThreeabove-ar.alt;
} calt6;

For each of the rules in that lookup, add another rule that includes @Beh_init_medi_mark twice.

For example, for this rule:

sub @Beh_init_medi @Beh_init_medi_mark [ alef-ar.fina ]' by alef-ar.alt;

Add another rule:

sub @Beh_init_medi @Beh_init_medi_mark @Beh_init_medi_mark [ alef-ar.fina ]' by alef-ar.alt;

Think of it as pattern matching. Your rules only match sequences that contain one mark, they don’t match sequences that contain two marks. Thus you need to add a set of rules that match sequences containing two marks.

Great! Many Thanks
Right now, it works perfect!