RFR: 8319844 : Text/TextFlow.hitTest() is incorrect in RTL orientation [v11]
Karthik P K
kpk at openjdk.org
Thu Feb 15 10:39:05 UTC 2024
On Wed, 14 Feb 2024 05:27:19 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
> I think we should simplify the `getHitInfo` method in the `TextLayout` interface.
>
> The code currently seems to be making distinctions where there are none. `TextFlow`s provide spans, while `Text`s provide a text. `getHitInfo` can take advantage of this to avoid the `text` and `forTextFlow` parameters altogether. This will reduce confusion (as there is no distinction) and also avoids cases that are non-sensical (providing `text` while `forTextFlow` is `true` or vice versa).
>
> Previous changes to this code (when the parameter `text` was introduced to `getHitInfo`) should probably be partially undone and simplified with this new knowledge.
Thanks for reviewing @hjohn
Certainly we could simplify the `getHitInfo` method but the complication starts when we have to support Text node embedded in TextFlow.
Just to differentiate Text node and TextFlow, spans can be used as you suggested. I had to introduce these parameters for the case of Text node embedded in TextFlow. On top of that we need to support emojis and RTL text. This is where it started getting complex and I had to use these new parameters. If you have any thoughts on this, please let me know.
I'll got through all the comments and incorporate wherever possible.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1323#issuecomment-1945799592
More information about the openjfx-dev
mailing list