RFR: 8316518 javafx.print.Paper getWidth / getHeight rounds values, causing errors.
Kevin Rushforth
kcr at openjdk.org
Fri Sep 22 18:24:15 UTC 2023
On Fri, 22 Sep 2023 18:07:50 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
> > yeah, I also don't quite understand why we have the rounding (I mean, floor'ing) here. I would vote to remove the typecast as the OP proposes.
>
> Phil has some concerns that will need to be looked into.
To follow-on, it seems that there are a few options.
1. Pass back the unmodified value. The concern that Phil raised is that this could lead to floating-point error. Of course the current code that truncates could also lead to errors. If the value ends up as, say, 10.9999 inches, we would want to return 11 rather than 10 even if we did want to limit it to integers.
2. Round the value to whole integers. This doesn't really solve the problem that the PR is trying to solve
3. Round to some number of decimal places, e.g., round to the nearest 0.01 or 0.001 inches.
4. Something else.
Option 3 seems like it might be a reasonable solution, but I'd want Phil to weigh in.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1244#discussion_r1334698234
More information about the openjfx-dev
mailing list