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

Andy Goryachev angorya at openjdk.org
Tue Jan 16 15:45:34 UTC 2024


On Tue, 16 Jan 2024 10:34:42 GMT, Karthik P K <kpk at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java line 562:
>> 
>>> 560:                     charIndex += textWidthPrevLine;
>>> 561:                     charIndex += relIndex;
>>> 562:                     if (run.getLevel() % 2 != 0) {
>> 
>> I wish there was an explanation of the meaning of `level`
>> And since there are several places where it checks for it being odd, I wish there was a method in TextRun with a descriptive name rather than this computation (and bit logic might be faster):
>> 
>> 
>> public boolean isLevelOdd() { // or whatever the meaning is
>>   return (level & 0x01) != 0; 
>> }
>
> Added comment and used bit logic in the condition.
> Do you think we should create a method in TextRun? I believe it is out of scope of this PR as it will be used in other functions as well.

Yes, creating such a new method in TextRun might be out of scope for this, unless we touch all the places where the bit logic is used.  Up to you, it's just a suggestion.

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

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


More information about the openjfx-dev mailing list