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

Kevin Rushforth kcr at openjdk.org
Thu May 1 19:01:58 UTC 2025


On Wed, 5 Feb 2025 21:21:09 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/scene/text/LayoutInfo.java line 91:
>> 
>>> 89:      * @return the immutable list of {@code Rectangle2D} objects
>>> 90:      */
>>> 91:     public abstract List<Rectangle2D> selectionShape(int start, int end, boolean includeLineSpacing);
>> 
>> I take that  `LayoutInfo::selectionShape` should match the existing API `TextFlow::rangeShape` for the same selection coordinates.
>>  
>> I wonder if you have tested this, with different insets. I take that with your current implementation, for `Rectangle2D` objects, it makes sense to have the insets of the TextFlow/Text node, but shapes don't include them.
>
> We've got https://bugs.openjdk.org/browse/JDK-8341438 and a possibility of a regression if we change the existing methods.
> 
> I would very much like to get your thoughts on this.

I also would like to hear thoughts about compatibility concerns around fixing [JDK-8341438](https://bugs.openjdk.org/browse/JDK-8341438).

If we are not going to fix it in the same release (JavaFX 25) as this Text LayoutInfo enhancement, I think we need a NOTE in the javadoc to clarify this difference.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1596#discussion_r2070663054


More information about the openjfx-dev mailing list