On Fri, 2 May 2025 16:57:02 GMT, Andy Goryachev <ango...@openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/text/Text.java line 2100: >> >>> 2098: * While there is no general guarantee that successive >>> invocations of this method return the same instance, >>> 2099: * it is safe to either cache this object or call this method >>> each time, since the information obtained from >>> 2100: * this lightweight object remains valid until the next layout >>> cycle. >> >> I'm trying to parse this to get a better idea of the model. If this really >> is a "view" into the current layout information for the text node, then the >> information returned by the getters in the TextLayout will change over time, >> right? >> >> This is true whether you call the TextLayoutInfo once on a given text node >> and reuse it for the life of that text node or whether you call >> `Text::getLayoutInfo` every time you want to use it. I guess that's what you >> are trying to say. If so, is there a need to mention that there is no >> guarantee that it will return the same instance? > > good comment. how does this sound: > > Returns the object which provides a snapshot of the text layout geometry for > this node. Oh, so it _isn't_ a view but a copy. I think what you changed it to is closer. The "object which provides a snapshot" is a little misleading, though. It is this method that _provides_ the snapshot. The returned TextLayout object _is_ the snapshot. Maybe something like this? * Returns a copy of the of the text layout geometry for this node. This copy is a snapshot * of the text layout at the time the method is called. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1596#discussion_r2101142533