RFR: 8330559: Trailing space not rendering correctly in TextFlow in RTL mode

Andy Goryachev angorya at openjdk.org
Fri May 31 17:24:07 UTC 2024


On Fri, 31 May 2024 14:39:00 GMT, Karthik P K <kpk at openjdk.org> wrote:

> The issue is specific to Mac. The glyph positions returned from native side for complex text is not handled in the text render logic. This issue is observed only when trailing spaces are present along with LTR text mixed with RTL text (Example: "Arabic: العربية").
> 
> Made changes in `getPosX` of `TextRun` class to handle negative values.
> 
> Tested the changes manually with the sample code present in the bug and using the MonkeyTester.

Seems to work with the example in the ticket and the TextArea in the Monkey Tester.  No ill effects on Windows.  (Did not test it on Linux)

Could you come up with a unit test?

modules/javafx.graphics/src/main/java/com/sun/javafx/text/TextRun.java line 332:

> 330:                 return x;
> 331:             }
> 332:             int prevIdx = (glyphIndex - 1)<<1;

would it be possible to add a comment explaining why this code is doing what it's doing?  specifically, the reason for the while() loop and Math.abs().  and perhaps mention that this happens on mac only.

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

PR Review: https://git.openjdk.org/jfx/pull/1468#pullrequestreview-2091311343
PR Review Comment: https://git.openjdk.org/jfx/pull/1468#discussion_r1622706698


More information about the openjfx-dev mailing list