RFR: 8341670: [Text, TextFlow] Public API for Text Layout Info [v16]
Kevin Rushforth
kcr at openjdk.org
Thu May 1 18:56:02 UTC 2025
On Wed, 5 Feb 2025 21:18:20 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);
>>
>> See my comment below about using `javafx.scene.shape.Rectangle` instead of `javafx.geometry.Rectangle2D`: otherwise the API is misleading: `selectionShape` doesn't return a `Shape` subclass.
>
> Good point. The word 'shape' might be confusing, although it is still correct in human terms (it is a shape, after all). I think it's ok, but we could use the word "geometry" for these methods `selectionGeometry` / `strikeThroughGeometry` / `underlineGeometry`, what do other people think?
>
> As for using `javafx.scene.shape.Rectangle` - it is too heavy of an object, with properties and everything, it's not what we ask from this method.
Yeah, it might be better to use a different name. "geometry" seems fine to me. Or maybe "bounds" although it's a list of bounds, so that's a little less clear. I like "geometry" the best so far.
If we do this, then you could even add the "get" at the beginning of the name (as suggested by Michael), since it would no longer duplicate the equivalent name in Text/TextFlow. I don't have a strong opinion either way on this one.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1596#discussion_r2070609419
More information about the openjfx-dev
mailing list