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

Reply via email to