Richard,

Thank you for the patch.

It works as expected. And j.s.t.AbstractDocument tests which depend on
j.t.Bidi stopped failing.


I have another issue with the Bidi implementation. It is its
incompatibility with the RI with regard to processing of new lines in
the text.

The Unicode Bidirectional Algorithm [1] states that text should be
divided into paragraphs, which are processed separately.
This is true for Harmony implementation of Bidi, and it's false for the
RI. That's why the third run has level 0 (on RI) rather than 2 (on
Harmony).
>>>>> 2: 0 [5, 7]


I prefer Harmony follows the standard. In this case, the code in
j.s.t.AbstractDocument, which is in charge for bidirectional text
support, may be somewhat optimized. Now AbstractDocument handles new
lines (paragraphs) explicitly, and we can drop this code since Bidi will
handle it.

Thanks,
Alexey.


[1] http://www.unicode.org/reports/tr9/

--
Alexey A. Ivanov
Intel Middleware Product Division


>-----Original Message-----
>From: Richard Liang [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, August 22, 2006 7:40 AM
>To: harmony-dev@incubator.apache.org
>Subject: Re: [classlib][text] Bidi returns directional runs in visual
order
>rather than in logical
>
>Sorry for my late reply, Alexey.
>
>I'm discussing this issue with ICU team, and have not drawn any
conclusion
>till now.
>
>Richard.
>
>Ivanov, Alexey A wrote:
>> Hello Richard,
>>
>> Have you taken a look at this issue?
>>
>> Thanks,
>> --
>> Alexey A. Ivanov
>> Intel Middleware Product Division
>>
>>
>>> -----Original Message-----
>>> From: Richard Liang [mailto:[EMAIL PROTECTED]
>>> Sent: Tuesday, August 08, 2006 12:12 PM
>>> To: harmony-dev@incubator.apache.org
>>> Subject: Re: [classlib][text] Bidi returns directional runs in
visual
>>>
>> order
>>
>>> rather than in logical
>>>
>>> Hello Ivanov,
>>>
>>> I will have a look at this issue, and will give my feedback later.
>>> Thanks a lot.
>>>
>>> Best regards,
>>> Richard.
>>>
>>> Ivanov, Alexey A wrote:
>>>
>>>> All,
>>>>
>>>> I'd like to attract more attention to this problem because this
>>>> incompatibility makes many tests in javax.swing.text package fail.
>>>>
>> The
>>
>>>> implementation of jx.s.t.AbstractDocument depends on j.t.Bidi.
>>>>
>>>> The root of the problem lies in ICU library. Here we have two
>>>>
>> options:
>>
>>>> 1. Fix the Bidi implementation, to be more precise its counterpart
in
>>>> ICU;
>>>> 2. Fix AbstractDocument to handle such illogical run order.
>>>>
>>>>
>>>> Can text guys comment on this issue?
>>>>
>>>>
>>>> I decided to cite the test case from the JIRA:
>>>> public class Test {
>>>>     public static final String LTR = "\u0061\u0062"; // these are
>>>>
>> "ab"
>>
>>>>     public static final String RTL = "\u05DC\u05DD";
>>>>     public static final String newLine = "\n";
>>>>
>>>>     public static final String defText = LTR + newLine
>>>>                                          + RTL + LTR + RTL;
>>>>     public static void main(String[] args) {
>>>>         Bidi bi = new Bidi(defText,
>>>>                            Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT);
>>>>
>>>>         System.out.println("Runs: ");
>>>>         final int count = bi.getRunCount();
>>>>         for (int i = 0; i < count; i++) {
>>>>             System.out.println(i + ": " + bi.getRunLevel(i)
>>>>                                + " [" + bi.getRunStart(i)
>>>>                                + ", " + bi.getRunLimit(i)
>>>>                                + "]");
>>>>         }
>>>>     }
>>>> }
>>>>
>>>>
>>>> Thank you in advance.
>>>> --
>>>> Alexey A. Ivanov
>>>> Intel Middleware Product Division
>>>>
>>>>
>>>> P.S. Shall I add "compatibility" to the subject line?
>>>>
>>>>
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: Ivanov, Alexey A [mailto:[EMAIL PROTECTED]
>>>>> Sent: Tuesday, August 01, 2006 3:27 PM
>>>>> To: harmony-dev@incubator.apache.org
>>>>> Subject: [classlib][text] Bidi returns directional runs in visual
>>>>>
>> order
>>
>>>>> rather than in logical
>>>>>
>>>>> Hi all.
>>>>>
>>>>> Harmony implementation of java.text.Bidi returns directional runs
>>>>> (getRunStart(), getRunLimit(), getRunLevel()) in visual order if
>>>>> paragraph reading order is Right-to-Left. I mean the first run is
at
>>>>>
>>>>>
>>>> the
>>>>
>>>>
>>>>> end of character buffer, and the last is at the beginning. I'd
>>>>>
>> expect
>>
>>>>> directional runs are enumerated in the order of the characters in
>>>>>
>> the
>>
>>>>> buffer, i.e. the logical order.
>>>>>
>>>>> I've created a JIRA issue for this:
>>>>> https://issues.apache.org/jira/browse/HARMONY-1028
>>>>>
>>>>> Another difference from the RI is that in Harmony the text is
>>>>>
>> divided
>>
>>>>> into paragraphs before directional analysis, which is not done in
>>>>>
>> the
>>
>>>> RI
>>>>
>>>>
>>>>> despite the Unicode Bidirectional Algorithm [1] requires it.
>>>>>
>>>>>
>>>>> The output of the test case when run on Harmony:
>>>>> 0: 0 [0, 3]
>>>>> 1: 1 [7, 9]
>>>>> 2: 2 [5, 7]
>>>>> 3: 1 [3, 5]
>>>>>
>>>>> However, I'd expect the following output:
>>>>> 0: 0 [0, 3]
>>>>> 1: 1 [3, 5]
>>>>> 2: 2 [5, 7]
>>>>> 3: 1 [7, 9]
>>>>>
>>>>> The output of the test case when run on the RI:
>>>>> 0: 0 [0, 3]
>>>>> 1: 1 [3, 5]
>>>>> 2: 0 [5, 7]
>>>>> 3: 1 [7, 9]
>>>>>
>>>>>
>>>>> Any thoughts?
>>>>>
>>>>> [1] http://www.unicode.org/reports/tr9/
>>>>>
>>>>>
>>>>> Regards,
>>>>> --
>>>>> Alexey A. Ivanov
>>>>> Intel Middleware Product Division
>>>>>
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>
>>>>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>>>>> To unsubscribe, e-mail:
[EMAIL PROTECTED]
>>>>> For additional commands, e-mail:
>>>>>
>> [EMAIL PROTECTED]
>>
>>>>
---------------------------------------------------------------------
>>>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>>>> To unsubscribe, e-mail:
[EMAIL PROTECTED]
>>>> For additional commands, e-mail:
>>>>
>> [EMAIL PROTECTED]
>>
>>>>
>>>>
>>> --
>>> Richard Liang
>>> China Software Development Lab, IBM
>>>
>>
>> ---------------------------------------------------------------------
>> Terms of use : http://incubator.apache.org/harmony/mailing.html
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail:
[EMAIL PROTECTED]
>>
>>
>>
>
>--
>Richard Liang
>China Software Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to