[OpenJDK 2D-Dev] RFR: 8048583: CustomMediaSizeName class matching to standard media is too loose

Andrew Brygin andrew.brygin at oracle.com
Fri Jul 11 09:16:18 UTC 2014


Hello Phil,

   79                 float dw = Math.abs(w - width);
   80                 float dh = Math.abs(h - length);
   81                 if (w > 0.1 || h > 0.1) {
   82                     mediaName = null;
   83                 }

I have an impression that we have to check dw and dh on line 81,
haven't we?

Could you please clarify this?

Thanks,
Andrew

On 6/28/2014 12:40 AM, Phil Race wrote:
> Bug : https://bugs.openjdk.java.net/browse/JDK-8048583
> Fix : http://cr.openjdk.java.net/~prr/8048583/
>
> As described in the bug the basic problem is that we associate
> a printer defined media with an inappropriate "standard" media.
>
> If there's no standard media that matches to within a fraction,
> don't return one.
>
> It is difficult to provide a direct or useful test for this as
> knowing if its right requires having a  CUPS printer
> which triggers the code and even then this isn't exposed directly.
> It bubbles up as somewhat odd margins for the page ..
>
> But hopefully it should be apparent that saying the paper
> size matches to a different size is a problem.
>
> Returning null from CustomMediSizeName.getStandardMedia()
> is something that already is possible and I did double-check all
> the callers seem to be looking for the possibility of null.
>
> -phil.
>
>




More information about the 2d-dev mailing list