RFR: 8242548: Honor line spacing in Labeled reflow calculation

Ajit Ghaisas aghaisas at openjdk.java.net
Thu Apr 23 08:55:23 UTC 2020


On Wed, 22 Apr 2020 15:54:09 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

>> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/skin/Utils.java line 426:
>> 
>>> 425:
>>> 426:         height += lineSpacing;
>>> 427:
>> 
>> Modifying 'height' parameter seems incorrect as this parameter is used in other calculations below. If needed, use a
>> separate local variable to use 'height+lineSpacing'
>
> The height used needs to be changed everywhere.  However, I can move this to the caller instead, with a comment
> explaining why:
>> The computeClippedWrappedText call works with full lines (height of line + line spacing), including the last line.
>> However the wrap height does not include the line spacing for the last line.  In order to avoid wrapping the last line
>> of text even though there is sufficient space the wrap height passed to computeClippedWrappedText is increased with the
>> line spacing so it computes the correct text.

I see your point. I am OK with the changes that you have done.

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

PR: https://git.openjdk.java.net/jfx/pull/173


More information about the openjfx-dev mailing list