On Tue, 8 Oct 2024 16:07:54 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
> 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 immutable `LayoutInfo` structure contains information about: > > - text lines: offsets and bounds > - overall layout bounds > > TBD: > > the platform can also report additional information such as: > > - individual text lines' left and right side bearings (what are those?) > - text runs within each line modules/javafx.graphics/src/main/java/javafx/scene/text/LayoutInfo.java line 34: > 32: * @since 24 > 33: */ > 34: public interface LayoutInfo { Why an interface ? It is easier to evolve a class when you want to add more info. Also it should be sealed unless you can show why it is important that applications can create instances. It is being exposed for the benefit of RT but the class doc itself doesn't say when you might want to get one and why. It might also benefit from a succinct description of what "the text layout" means and encompasses. Oh and how do you know when it is no longer valid ? ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1596#discussion_r1792877433