RFR: 8341670: [Text, TextFlow] Public API for Text Layout Info [v16]
Andy Goryachev
angorya at openjdk.org
Wed Feb 5 20:31:21 UTC 2025
On Tue, 4 Feb 2025 18:47:14 GMT, Jose Pereda <jpereda at openjdk.org> wrote:
>> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 25 25
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/scene/text/TextLayout.java line 83:
>
>> 81: @FunctionalInterface
>> 82: public static interface GeometryCallback {
>> 83: public void addRectangle(float left, float top, float right, float bottom);
>
> I understand that you use `float` here because all the calculations in `PrismTextLayout::getRange` use floats (from `TextRun`).
>
> However, the calculations down the line to generate the `Rectangle2D` mix floats and doubles without any casting (`TextUtils::getRange` with implicit casts from double to float, `PrismLayoutInfo::getGeometry` with float and double sums).
>
> Do you think we could use doubles here instead?
the use of float in this interface is correct, but the code in TextUtils::getRange is bad, and i should feel bad. good catch!
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1596#discussion_r1943621599
More information about the openjfx-dev
mailing list