On Thu, 1 Feb 2024 08:06:18 GMT, Karthik P K <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java
>> line 513:
>>
>>> 511: if ((x > run.getWidth() &&
>>> (!isMultiRunText || run.getStart() == curRunStart)) || textWidthPrevLine >
>>> 0) {
>>> 512: getBounds(run.getTextSpan(),
>>> textBounds);
>>> 513: x -= (runs[0].getLocation().x -
>>> textBounds.getMinX());
>>
>> suggestion: we are still in the for loop, so perhaps it makes sense to
>> extract
>> `(runs[0].getLocation().x - textBounds.getMinX());`
>> to a variable outside of the loop
>
> The idea is that outside the loop we don't know if we need to subtract the
> textBound min x value and the starting location of the first run or not. That
> is why this is present inside the loop. Once this is done we are breaking out
> of the loop so this will not get called multiple times.
> Let me know if you have any suggestions.
you are right: I missed the `break` in line 520
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1323#discussion_r1474745002