On Tue, 14 Apr 2026 18:58:38 GMT, Marius Hanl <[email protected]> wrote:

>> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java
>>  line 172:
>> 
>>> 170:             layout.setWrapWidth((float)wrappingWidth);
>>> 171:             layout.setLineSpacing(0);
>>> 172:             layout.setBoundsType(TextLayout.BOUNDS_CENTER);
>> 
>> this change makes sense, but perhaps we should delegate to 
>> `computeTextHeight(Font font, String text, double wrappingWidth, double 
>> lineSpacing, TextBoundsType boundsType)` to eliminate parallel paths?
>> 
>> just like we do in `computeTextHeight(Font font, String text, double 
>> wrappingWidth, TextBoundsType boundsType)` just below it?
>> 
>> that is,
>> 
>> 
>> public static double computeTextWidth(Font font, String text, double 
>> wrappingWidth) {
>>   return computeTextHeight(font, text, wrappingWidth, 0, 
>> TextLayout.BOUNDS_CENTER);
>> }
>
> But then we would return the height? Which is wrong, as it is not the width?

oh right.  we can't really use the same code path, we'd need to release the 
layout after we get the requested value from it.  We could pass a lambda, but 
it's not worth it.  Please disregard.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2145#discussion_r3081765529

Reply via email to