RFR: 8319844 : Text/TextFlow.hitTest() is incorrect in RTL orientation

Andy Goryachev angorya at openjdk.org
Wed Jan 10 21:19:38 UTC 2024


On Wed, 10 Jan 2024 19:54:34 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> In the `getHitInfo()` method of PrismTextLayout, RTL node orientation conditions were not considered, hence hit test values such as character index and insertion index values were incorrect.
>> 
>> Added checks for RTL orientation of nodes and  fixed the issue in `getHitInfo()` to calculate correct hit test values.
>> 
>> Added system tests to validate the changes.
>
> modules/javafx.graphics/src/main/java/javafx/scene/text/TextFlow.java line 202:
> 
>> 200:             double x = point.getX();
>> 201:             double y = point.getY();
>> 202:             TextLayout.Hit h = layout.getHitInfo((float)x, (float)y, null, -1, -1);
> 
> -1 looks like magic value, could you please describe it in the `com.sun.javafx.scene.tex.TextLayout` javadoc in both cases (textRunStart and curRunStart)?

or, would it make more sense to simply pass a boolean flag instead of magic values?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1323#discussion_r1447936114


More information about the openjfx-dev mailing list