RFR: 8296266: TextArea: Navigation breaks with RTL text

Andy Goryachev angorya at openjdk.org
Mon Oct 9 22:54:08 UTC 2023


On Mon, 9 Oct 2023 22:42:45 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> JDK 8u doesn't have the fixes to deal with all of the macOS fonts in current macOS, so its a little hard for me to test Arabic/bidi there since I get garbage text.
>> 
>> I don't see that mirroring that you see, neither setting it on the TextArea or on the Scene, but the text is way off to the right.
>> Some layout issue.
>
> ^^ this looks like a separate bug, as it merely mirror images the whole SwingNode or its content.
> Setting ComponentOrientation produces desired result, so perhaps we'd need to bind SwingNode's content component orientation to its node orientation.
> 
> But anyway, within JTextArea, the RIGHT arrow *always* moves to the right, and the LEFT arrow always moves to the left (of screen), regardless of component orientation which I think might be the "objectively correct" behavior.
> 
> Curiously, MS Word does not work this way, instead moving cursor *logically*.
> 
> The fixed code works similarly to what MS Word does, reversing the apparent direction within RTL/LTR blocks:
> - In the LTR orientation, left moves the cursor left and right - to right within LTR text, which is what we want.
> - In the RTL orientation, left moves left and right moves right within RTL text, which is also what we want.
> 
> I suppose the decision to work similarly to MS Word (and differently from swing?) was made early on and we are stuck with it.
> 
> Sooo, I guess the fix works as designed?
> (I agree with your other objections to naming and javadoc, will fix).

> JDK 8u doesn't have the fixes to deal with all of the macOS fonts in current macOS, so its a little hard for me to test Arabic/bidi there since I get garbage text.

if I remember correctly, explicitly setting an Arabic font removes the garbage.

> I don't see that mirroring that you see, neither setting it on the TextArea or on the Scene, but the text is way off to the right.

I've added this to the MonkeyTester (standalone revision)
https://github.com/andy-goryachev-oracle/MonkeyTest
Tools -> JTextArea 
and
Window -> Orientation: RTL

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1220#discussion_r1350934479


More information about the openjfx-dev mailing list