RFR: 8306083: Text.hitTest is incorrect when more than one Text node in TextFlow [v9]

Andy Goryachev angorya at openjdk.org
Thu Oct 12 19:40:23 UTC 2023


On Thu, 12 Oct 2023 09:40:18 GMT, Karthik P K <kpk at openjdk.org> wrote:

>> The text run selected in `PrismTextLayout::getHitInfo()` method for character index calculation was not correct when hitTest was invoked for Text node in a TextFlow with more than one Text child. Hence wrong character index value was calculated.
>> 
>> Since only x, y coordinates were available in the above mentioned method, sending the text as a parameter to this method is necessary so as to know if the text run selected for character index calculation is correct. Along with this change modified the `PrismTextLayout::getHitInfo()` method to calculate the correct character index.
>> 
>> Added tests to validate the changes.
>
> Karthik P K has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix repeating text node issue

Another observation, and it may be a different issue.  If i try to insert a Text instance with -fx-scale-x:200% into the flow, the scale affects the glyph rendering but neither caretShape, preferredWidth, nor hitInfo:


                t("BOLD ", f, "-fx-font-weight:bold;"),
                t("BOLD ", f, "-fx-font-weight:100; -fx-scale-x:200%;"),
                t("BOLD ", f, "-fx-font-weight:900;"),


![Screenshot 2023-10-12 at 12 33 36](https://github.com/openjdk/jfx/assets/107069028/6ad828af-fc24-4761-a798-dbb071d98e5e)

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

PR Comment: https://git.openjdk.org/jfx/pull/1157#issuecomment-1760256042


More information about the openjfx-dev mailing list