Integrated: 8357594: Additional geometry-based Text/TextFlow APIs
Andy Goryachev
angorya at openjdk.org
Fri Jul 11 22:33:45 UTC 2025
On Tue, 27 May 2025 18:48:45 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
> ## Summary
> This change adds new methods to the `TextFlow` which work correctly in the presence of non-empty insets (borders/padding). For backward compatibility, the old buggy methods are getting deprecated (not for removal). Also, adds new methods in Text which provide missing functionality.
>
> ## Problem
> A number of methods in `TextFlow` fail to return correct values in the presence of non-empty insets (i.e. when either padding or border are set):
> - caretShape
> - hitTest
> - rangeShape
>
> Additionally, the current API fail to provide strike-through shape, and account for line spacing in the range shape, a problem shared between the `TextFlow` and the `Text` classes.
>
> ## Solution
> The solution is two-fold:
> 1) deprecate the buggy methods (not for removal), adding explanations in their javadoc comments
> 2) add new methods that behave correctly in the presence of non-empty insets and/or implementing the missing functionality.
>
> The proposed solution retains the buggy methods for the purposes of backward compatibility in applications which employ the workarounds, while providing new APIs with additional parameters similar to those offered by the new TextLayout API https://bugs.openjdk.org/browse/JDK-8341670
>
> ## Testing
>
> Additional visualization of the data returned by the new APIs is available in the Monkey Tester using the following branch (in the Text and TextFlow pages):
>
> https://github.com/andy-goryachev-oracle/MonkeyTest/tree/text.insets.corrected
This pull request has now been integrated.
Changeset: 04c5e40c
Author: Andy Goryachev <angorya at openjdk.org>
URL: https://git.openjdk.org/jfx/commit/04c5e40cc116cb42150572959b53d1e465700e0e
Stats: 556 lines in 5 files changed: 522 ins; 18 del; 16 mod
8357594: Additional geometry-based Text/TextFlow APIs
Reviewed-by: kcr, mstrauss
-------------
PR: https://git.openjdk.org/jfx/pull/1817
More information about the openjfx-dev
mailing list