[FriBidi] fribidi_reorder_runs()

Eduardo Castiñeyra eduardo at brainstorm3d.com
Wed Feb 8 18:20:59 UTC 2017



On 2/8/2017 7:02 PM, Eli Zaretskii wrote:
>> Cc: fribidi at lists.freedesktop.org
>> From: Eduardo Castiñeyra <eduardo at brainstorm3d.com>
>> Date: Wed, 8 Feb 2017 16:59:04 +0100
>>
>> On 2/7/2017 5:19 PM, Eli Zaretskii wrote:
>>>> From: Eduardo Castiñeyra <eduardo at brainstorm3d.com>
>>>> Date: Tue, 7 Feb 2017 16:39:01 +0100
>>>>
>>>> It turned out that our incorrect way to integrate fribidi and harfbuzz
>>>> (let fribidi reorder all the characters and shape as full LTR in
>>>> harfbuzz) is "surprisingly" causing problems.
>>>>
>>>> The problem is mainly with the parenthesis. It looks like the shaper
>>>> should flip the direction of the parenthesis when it belongs to a RTL run.
>>> Shouldn't reordering mirror parentheses if their level is even?
>> AFAIK, parenthesis are neutral, they inherit the direction of the text
>> surrounding them
> Yes, and if the surrounding text is RTL, the parentheses should be
> mirrored as part of reordering.  See L4 in the UBA (a.k.a. "UAX#9")
> description.  It says:
>
>    A character is depicted by a mirrored glyph if and only if (a) the
>    resolved directionality of that character is R, and (b) the
>    Bidi_Mirrored property value of that character is Yes.
>

That makes sense. Nevertheless the direction of the parenthesis is just 
an example of why we need that fribidi_reorder_runs function which was 
what my question was actually about.

I think that, in a glyph based renderer, changing the direction of the 
parenthesis should be on harfbuzz's roof not fribidi. fribidi's 
responsibility would be limited to reordering the runs and labeling them 
with their level.

Behdad proposed an algorithm to reorder the runs ourselves

https://github.com/behdad/linear-reorder/blob/master/linear-reorder.c

but he also implemented it in FriBiDi and then rolled it back.  Of 
course we'd rather use the one implemented in FriBiDi as soon as it is 
available. Hence my question.



More information about the fribidi mailing list