Hi Behdad,

I've noticed that shaping isn't working correctly for text with overridden 
direction; this shows up with examples like

  data:text/html,<p 
style="unicode-bidi:bidi-override;direction:ltr;font-family:scheherazade">العربي

in harfbuzz-ng-based Firefox builds.

The problem arises because hb_ot_shape_execute_internal() does 
hb_ot_shape_setup_masks() before it calls hb_ensure_native_direction(), which 
may reverse the buffer; but this means that the feature masks are set based on 
the original direction of the buffer, not its overridden direction.

Moving the call to hb_ot_shape_setup_masks() after hb_ensure_native_direction() 
seems to fix this, but I'm not sure if there are other potential issues 
(relating to mirroring, for example) that might complicate this. Alternatively, 
if it's problematic to reorder the stages here, I suppose 
_hb_ot_shape_complex_setup_masks_arabic() could be made direction-aware, and 
iterate backwards over the buffer in the LTR-override case. But that will be an 
issue for all complex-script shapers, so I think it's preferable to fix it at 
the hb_ot_shape_execute_internal() level.

Jonathan

_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz

Reply via email to