On Sat, 23 Sep 2023 06:02:14 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

>> About the rounding; all these values are fixed values and could have been 
>> entered in points as constants directly.
>> 
>> Also realize that all papers measured in inches can be expressed exactly in 
>> points (after the above errors are fixed) so no rounding is needed for those 
>> at all; the same is not true for the papers specified in millimeters.
>> 
>> Since the papers in inches never should need any rounding, the rounding can 
>> therefore be removed for those.  If there is a worry that the multiplication 
>> (* 72) may cause floating point errors, then I suggest to specify all papers 
>> in points immediately, like this:
>> 
>>     new Paper("Letter", 8.5 * 72, 11 * 72, POINT);
>> 
>> As for the papers specified in millimeters, these can't be expressed in 
>> whole points, as a millimeter is equivalent to `2,83465` points.  Rounding 
>> them to points will require some guess work to find out what the actual size 
>> in millimeters was, for example, when it says 3 points it must have been 1 
>> mm, while 1, 2, 4 or 5 points has no direct mm equivalent.
>
> It is also very odd that `Paper` would expose the name (like `A4`), but not 
> the unit (`MM`) and the exact sizes for those.  Representing these in a UI 
> therefore becomes terribly complicated; if I want to show the user, I can 
> show them the name, but then when I want to display its size, I have to show 
> it in points (a useless measurement, for users, for both papers specific in 
> inches and mm).

Typically paper sizes are displayed in whatever units are appropriate for the 
locale. On my Mac all paper sizes are displayed in whole millimeters if the 
locale is United Kingdom and inches (to 1/100 of an inch) if the locale is 
United States.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1244#discussion_r1335047374

Reply via email to