RFR: 8316518 javafx.print.Paper getWidth / getHeight rounds values, causing errors.

John Hendrikx jhendrikx at openjdk.org
Tue Oct 17 09:43:48 UTC 2023


On Tue, 17 Oct 2023 09:23:16 GMT, Florian Kirmaier <fkirmaier at openjdk.org> wrote:

> It would be nice if something could be decided here.
> 
> Another option would be, to rename the current method to something like getWidthInPoints() which then can be used internally. But the old - now correct methods - can be exposed to applications, returning correct values.
> 
> But I would still prefer to just fix it, returning the correct values. And if it turns out, at some part we need it in points, then we just have to convert it to this location. I still don't see how the current state doesn't lead to various incorrect behaviors.

I think the methods should return the unrounded values (getWidth/getHeight).  Nothing in the API docs precludes this (it isn't even mentioned that it does this); just mentioning that it returns things in points does not mean they're rounded.

Compare this with other methods in JavaFX that mention the unit (ie. pixels for Nodes, seconds for Animation/Timelines) that don't round those.

So thumbs up from me for this change.

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

PR Comment: https://git.openjdk.org/jfx/pull/1244#issuecomment-1766051265


More information about the openjfx-dev mailing list