JDK-8314482 : TextFlow: TabStopPolicy
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Priority: P3
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2023-08-16
  • Updated: 2025-05-19
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
tbdUnresolved
Related Reports
Blocks :  
Blocks :  
Blocks :  
Duplicate :  
Relates :  
Relates :  
Description
JavaFX text layout is missing support for a tab policy beyond fixed tab size added in JDK-8130738.

Ideally, a TabStopPolicy should support features present in the common RTF editor such as TextEdit (see the screenshot), and possibly go beyond:

- fixed tab size (for a monospaced font use case only)
- fixed tab size policy (N, 2N, 3N, ... pixels)
- arbitrary set of user-defined tab stops
- left tab stop (default)
- center tab stop
- right tab stop
- decimal tab stop

The tab stop policy API may need to support variations, such as locale-specific decimal point for decimal tab stops, or how the tab stops are generated once the text goes beyond the last defined tab stop, i.e. whether it should use a fixed number of pixels, or some other logic.

It's also worth noting that MS Word adds a bar tab stop and a number of leader options (see the screenshot).

Unlike tabSize property, the TabStopPolicy property is paragraph-based, so likely to be a part of TextFlow.

https://github.com/andy-goryachev-oracle/Test/blob/main/doc/TabStopPolicy/TabStopPolicy.md
(updated 2023/12/11)

edit 2025/05/19: this ticket will add a TabStopPolicy which allows to set the tab stop positions only, plus the default tab stops.
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jfx/pull/1744 Date: 2025-03-26 14:41:51 +0000
19-05-2025

A handy illustration of why tabSize is insufficient and why we need a TabStopPolicy: https://bugs.openjdk.org/secure/attachment/105183/Screenshot%202023-08-21%20at%2008.59.27.png
21-08-2023

Would you say the TabStopPolicy must take precedence over tabSize? Another thing the TabStopPolicy attribute should work at the paragraph level, regardless of each individual Text font size.
18-08-2023

Tab size is handled on the Text node https://openjfx.io/javadoc/18/javafx.graphics/javafx/scene/text/Text.html#setTabSize(int) So very likely this will require API there as this would change the behaviour of that. This would then have to be used by the higher level constructs
18-08-2023