RFR: 8341670: [Text,TextFlow] Public API for Text Layout Info

Andy Goryachev angorya at openjdk.org
Tue Oct 8 18:21:18 UTC 2024


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

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

Commit messages:
 - bounds
 - draft api

Changes: https://git.openjdk.org/jfx/pull/1596/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1596&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8341670
  Stats: 271 lines in 5 files changed: 259 ins; 9 del; 3 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


More information about the openjfx-dev mailing list