[OpenJDK 2D-Dev] [9] RFR JDK-6789262: getPageFormat doesn't apply PrintRequestAttributeSet specified

Phil Race philip.race at oracle.com
Thu Jun 30 21:59:03 UTC 2016


Shouldn't these all be >= and <= ?
Else (eg) for X==1 in both cases you would return false when it should 
be true ..

f ((mpa.getX(units) > mediaPrintables[i].getX(units)) &&


-phil.


On 06/30/2016 03:31 AM, Prasanta Sadhukhan wrote:
> Hi Phil,
>
> I modified the method to check for "fit" rather than perfect match as 
> you suggested.
> Please find the modified webrev
> http://cr.openjdk.java.net/~psadhukhan/6789262/webrev.01/
>
> Regards
> Prasanta
> On 6/29/2016 11:29 PM, Philip Race wrote:
>> This is actually a little subtle.
>>
>> The check you are deleting has been there since 2000 ..
>> and it can't just be removed. But it need adjusting.
>> This is the subtlety. Most of the attribute checks
>> are yes/no. I think for this one we need to look at
>> the actual dimensions and return true if it is "fits"
>> So isSupportedMediaPrintableArea needs to do more than "equals"
>> I am not 100% sure that won't surprise some other code but
>> as far as I can think right now it seems the right thing to do.
>>
>> -phil.
>>
>> On 6/27/16, 4:27 AM, Prasanta Sadhukhan wrote:
>>> Hi All,
>>>
>>> Please review a fix for an issue where it was found that setting 
>>> left margin of 2" is ignored and when we query 
>>> PrinterJob.job.getPageFormat(PrintRequestAttributeSet)
>>> we get the default paper mediapritable area of x=1" instead of the 
>>> set 2".
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-6789262
>>> webrev: http://cr.openjdk.java.net/~psadhukhan/6789262/webrev.00/
>>>
>>> This is because
>>> it was found that getPageFormat() calls 
>>> Win32PrintService#isAttributeValueSupported() where we call
>>> isSupportedMediaPrintableArea()
>>> to check if the mediaprintable area is matching with the media size 
>>> that has been cached. It gets the paperID by calling findPaperID() 
>>> and stores the mpa of that paper in MediaPrintableArea[]
>>> I see that my printer supports 43 mediasize names (like iso_a4, 
>>> iso_a5, na_letter etc) and none of the 43 mediaPrintables equals the 
>>> mpa value of (50.4, 25.4, 133.8, 246.2)mm
>>>
>>> ---------------isSupportedMediaPrintableArea()---------
>>> if (mediaPrintables != null) {
>>>             for (int i=0; i<mediaPrintables.length; i++) {
>>>                 if (mpa.equals(mediaPrintables[i])) {
>>>                     return true;
>>>                 }
>>>             }
>>>         }
>>> ----------------------
>>> So, it seems this check isSupportedMediaPrintableArea() is 
>>> preventing valid mpa values to be propagated to RasterPrinterJob to 
>>> be used for printing.
>>>
>>> I see in linux and mac, 
>>> *IPPPrintService*#isAttributeValueSupported() is called which does 
>>> not have this isSupportedMediaPrintableArea() check and there this 
>>> left margin of 2" is not ignored and stored properly.
>>>
>>> So, the proposed fix do away with this 
>>> isSupportedMediaPrintableArea() call from 
>>> Win32PrintService#isAttributeValueSupported.
>>>
>>> Regards
>>> Prasanta
>>>
>>>
>>>
>>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160630/71b1c74d/attachment.html>


More information about the 2d-dev mailing list