RFR: 8316518 javafx.print.Paper getWidth / getHeight rounds values, causing errors.
Michael Strauß
mstrauss at openjdk.org
Thu Oct 26 01:54:41 UTC 2023
On Tue, 19 Sep 2023 11:56:39 GMT, Florian Kirmaier <fkirmaier at openjdk.org> wrote:
> The Method javafx.print.getWidth and getHeight returns a double of points.
> But the values are always rounded to full integers. This causes especially problems,
> with mm based Papers.
>
> I asked in the mailing list, with the conclusion (me and John Hendrix) that is best to just fix this behavior by removing the rounding.
modules/javafx.graphics/src/main/java/javafx/print/Paper.java line 85:
> 83: case MM : return (dim * 72) / 25.4;
> 84: }
> 85: return dim;
Minor: you can use an enhanced `switch` expression here, which also ensures exhaustiveness:
return switch (units) {
case POINT -> dim;
case INCH -> dim * 72;
case MM -> (dim * 72) / 25.4;
};
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1244#discussion_r1372483292
More information about the openjfx-dev
mailing list