Text rendering problem using OpenType font and cursive lookups with mixed RIGHT_TO_LEFT flag

Hi,

I am developing an OpenType font with the following cursive feature.

feature curs {  
  lookup cursivejoinrtl;  # RIGHT_TO_LEFT flag set between Hah, Meem, Yeh and final Meem
  lookup rehwawcursive; # RIGHT_TO_LEFT flag clear between Waw and Hah
} curs;

Here is the rendering of the word وحميم in TextEdit.

Using HarfBuzz I got the following result.

The same rendering problem occurs when using Safari. It seems that is related to Core Text.

I reported the issue to Feedback Assistant over a year ago but haven't had a response yet. So I'm posting the problem on this forum.

Any support on this matter would be greatly appreciated.

The issue arises even when there are two disjoint cursive segments.

To isolate what is happening, I reduced the cursive lookups to only the two following lookups.

lookup coretexttest_rtl_clear {
  lookupflag IgnoreMarks;
  pos cursive waw.isol <anchor NULL> <anchor 0 300> ;
  pos cursive smallalef.isol  <anchor 0 0 > <anchor NULL>;	
} coretexttest_rtl_clear;
lookup coretexttest_rtl_set {	
  lookupflag IgnoreMarks RightToLeft;
  pos cursive behshape.init <anchor NULL> <anchor 0 0> ;
  pos cursive lam.fina  <anchor 545 0 > <anchor NULL>;	
} coretexttest_rtl_set;
feature curs {
  lookup coretexttest_rtl_set;
  lookup coretexttest_rtl_clear;
} curs;

Below is the result of shaping the word “وَٰبل” in Safari 26.1.

The Beh sits higher than expected and does not visually align with Lam, even though there is no cursive positioning defined between the Alef and the Beh.

Text rendering problem using OpenType font and cursive lookups with mixed RIGHT_TO_LEFT flag
 
 
Q