On Tue, 19 Sep 2023 11:56:39 GMT, Florian Kirmaier <fkirma...@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.

Many of the Papers in the Paper Class are measured in MM, and the Paper Class 
simply returns wrong values.
A rounding like `.00001` should cause less problems than `.465` (A4).
A4 Paper simply returns wrong values.
If the developer uses these values, then the computations are wrong.
By using the correct values, we get visible more correct results.

In the mailing list, I also suggested 2 other solutions:
**Solution2:**
We could add new methods getExactWidth() / getExactHeight() , which returns the 
exact value without a rounding problem anywhere noticeable.

**Solution3:**
We could provide an API to access the width/height based on a given Unit.
like: getWidth(Unit.MM).
We already have implemented this, in our application code, so it wouldn’t be 
much effort.
But it would require moving com.sun.javafx.print.Units back to 
javafx.print.Paper.Units. (basically reverting JDK-8093699)


I could also implement one of these solutions, if that's preferred.
But i still don't see, how this rounding doesn't cause many unknown problems.

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

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

Reply via email to