[OpenJDK 2D-Dev] RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows
serb at openjdk.java.net
Wed Mar 10 01:51:11 UTC 2021
On Wed, 10 Mar 2021 01:48:28 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
>> Printing text using GlyphVector outline has bad quality on printers with low DPI on Windows.
>> The GDI system used for text printing on Windows accepts only integer path coordinates.
>> Rounding GlyphVector outline coordinates leads to distorted printed text.
>> The issue had been reported as JDK-8256264 but was reverted because of the regression JDK-8259007 "This test printed a blank page".
>> The fix JDK-8256264 scaled coordinates in wPrinterJob.moveTo()/lineTo() methods up and scaled transforms in wPrinterJob.beginPath()/endPath() down.
>> The regression was in the WPathGraphics.deviceDrawLine() method which uses wPrinterJob.moveTo()/lineTo() methods without surrounding them with wPrinterJob.beginPath()/endPath() so the line coordinates were only scaled up.
>> I tried to put wPrinterJob.beginPath()/endPath() methods around wPrinterJob.moveTo()/lineTo() in the method WPathGraphics.deviceDrawLine() but the line was not drawn at all even without scaling coordinates up and transform down (without JDK-8256264 fix). It looks like GDI treats this case as an empty shape.
>> The proposed fix applies path coordinates and transform scaling only in WPathGraphics.convertToWPath() method.
>> The one more PathPrecisionScaleFactorShapeTest.java manual test is added which checks that all methods that draw paths in WPathGraphics are used: line in WPathGraphics.deviceDrawLine() and SEG_LINETO/SEG_QUADTO/SEG_CUBICTO in WPathGraphics.convertToWPath() .
>> The `java/awt/print` and `java/awt/PrintJob` automatic and manual tests were run on Windows 10 Pro with the fix.
>> There are two failed automated tests which fail without the fix as well:
>> The following manual tests have issues on my system:
>> - `java/awt/print/Dialog/PrintDlgPageable.java` java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainThread cannot access a member of class PrintDlgPageable with modifiers "public static"
>> - `java/awt/print/PrinterJob/PrintAttributeUpdateTest.java` I select pages radio button, press the print button but the test does not finish and I do not see any other dialogs with pass/fail buttons.
>> - `java/awt/PrintJob/PrintCheckboxTest/PrintCheckboxManualTest.java` Tests that there is no ClassCastException thrown in printing checkbox and scrollbar with XAWT. Error. Can't find HTML file: test\jdk\java\awt\PrintJob\PrintCheckboxTest\PrintCheckboxManualTest.html
>> - `java/awt/print/PrinterJob/SecurityDialogTest.java` A windows with instructions is shown but it does not contain print/pass/fail buttons and it is not possible to close the window.
>> - The tests below fail with "Error. Parse Exception: Arguments to `manual' option not supported: yesno" message:
> Marked as reviewed by serb (Reviewer).
@prsadhuk please take a look
More information about the 2d-dev