> Please refer to > > https://github.com/andy-goryachev-oracle/Test/blob/main/doc/Text/LayoutInfo.md > > The RichTextArea control > ([JDK-8301121](https://bugs.openjdk.org/browse/JDK-8301121)), or any custom > control that needs non-trivial navigation within complex or wrapped text > needs a public API to get information about text layout. > > This change fixes the missing functionality by adding a new public method to > the `Text` and `TextFlow` classes.: > > > /** > * Obtains the snapshot of the current text layout information. > * @return the layout information > * @since 24 > */ > public final LayoutInfo getLayoutInfo() > > > The `LayoutInfo` provides a view into the text layout within > `Text`/`TextFlow` nodes such as: > > - text lines: offsets and bounds > - overall layout bounds > - text selection geometry > - strike-through geometry > - underline geometry > - caret information > > This PR also adds the missing `strikeThroughShape()` method to complement > existing `underlineShape()` and `rangeShape()` for consistency sake: > > > /** > * Returns the shape for the strike-through in local coordinates. > * > * @param start the beginning character index for the range > * @param end the end character index (non-inclusive) for the range > * @return an array of {@code PathElement} which can be used to create a > {@code Shape} > * @since 24 > */ > public final PathElement[] strikeThroughShape(int start, int end) > > > ## WARNING > > Presently, information obtained via certain Text/TextField methods is > incorrect with non-zero padding and borders, see > [JDK-8341438](https://bugs.openjdk.org/browse/JDK-8341438). > > It is not clear whether this PR should correct the computation at least for > the new APIs and keep the existing APIs as is to be fixed later, or if the > fix should be applied to both sets of APIs at the same time. > > > ## See Also > > https://github.com/FXMisc/RichTextFX/pull/1246
Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision: review comments ------------- Changes: - all: https://git.openjdk.org/jfx/pull/1596/files - new: https://git.openjdk.org/jfx/pull/1596/files/eb990081..6776d978 Webrevs: - full: https://webrevs.openjdk.org/?repo=jfx&pr=1596&range=08 - incr: https://webrevs.openjdk.org/?repo=jfx&pr=1596&range=07-08 Stats: 17 lines in 3 files changed: 5 ins; 0 del; 12 mod Patch: https://git.openjdk.org/jfx/pull/1596.diff Fetch: git fetch https://git.openjdk.org/jfx.git pull/1596/head:pull/1596 PR: https://git.openjdk.org/jfx/pull/1596