JDK-8341670 : [Text,TextFlow] Public API for Text Layout Info
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-10-07
  • Updated: 2025-06-17
  • Resolved: 2025-06-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx25 masterFixed
Related Reports
Blocks :  
Blocks :  
Blocks :  
CSR :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
The RichTextArea control (JDK-8301121), or any custom control that needs non-trivial navigation within complex or wrapped text needs a public API to get information about various aspects of the text layout.

One possibility is to add a new method to Text / TextFlow:
  public LayoutInfo getLayoutInfo()

Where LayoutInfo structure provides methods for querying the following information:

- text lines: offsets and bounds
- overall layout bounds
- text selection geometry (JDK-8341672)
- strike-through geometry (JDK-8341672)
- underline geometry (JDK-8341672)

The line bounds obtained via LayoutInfo might help address JDK-8091012 "[Text] No way to distinguish between a hit to the last character and a hit beyond the end of text", albeit indirectly.

The RichTextArea requires such a public API in TextFlow only, but we'll basically get the same functionality for Text node for free.

See also
https://github.com/andy-goryachev-oracle/Test/blob/main/doc/Text/LayoutInfo.md
Comments
Changeset: 1ea980ea Branch: master Author: Andy Goryachev <angorya@openjdk.org> Date: 2025-06-17 14:48:56 +0000 URL: https://git.openjdk.org/jfx/commit/1ea980ea6104ce39994fee0fcbaa460888a2747e
17-06-2025

[~tmikula] this API should also address JDK-8091012 could you double check please?
08-10-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1596 Date: 2024-10-08 16:07:54 +0000
08-10-2024