JDK-8307861 : TextFlow.underlineShape()
  • Type: CSR
  • Component: javafx
  • Sub-Component: graphics
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: jfx21
  • Submitted: 2023-05-10
  • Updated: 2023-05-11
  • Resolved: 2023-05-11
Related Reports
CSR :  
Description
Summary
-------

Adding TextFlow.underlineShape() to add support for a spellchecker-like decoration, mirroring a similar method in Text with the same signature.

Problem
-------

Underline shape in TextFlow is needed to enable spellchecker decoration (squiggly line) under text region that might span multiple Text segments.

Solution
--------

Add a new method, TextFlow.underlineShape(int, int).


Specification
-------------

/modules/javafx.graphics/src/main/java/javafx/scene/text/TextFlow.java
```
+    /**
+     * Returns the shape for the underline 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 21
+     */
+    public final PathElement[] underlineShape(int start, int end) {
```

Comments
Moving to Approved.
11-05-2023

Looks good. Since this is such a simple change, I recommend moving this directly to Finalize (no need for a two stage review of the CSR).
11-05-2023

thank you for the comments, I've updated the CSR.
10-05-2023

Looks good with three minor comments: Compatibility Risk: Adding a new method is usually minimal risk, which it is in this case. For non-final classes, there is always some small source compatibility risk, so I might remove the bit about "providing complete backward compatibility". Solution: The solution is to add the new public method. It is irrelevant to the CSR that there happens to be an existing private method that the implementation of the new method will call. Specification: You can remove the implementation (the `return getRange` line) of the new method, since it isn't part of the spec.
10-05-2023