<AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

<AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Alexander Scherbatiy-2
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:
java/awt/print/PrinterJob/GlyphPositions.java
java/awt/print/PrinterJob/PSQuestionMark.java

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:
java/awt/print/Dialog/DialogOrient.java
java/awt/print/Dialog/DialogType.java
java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
java/awt/print/PrinterJob/PageDialogTest.java
java/awt/print/PrinterJob/PageRanges.java
java/awt/print/PrinterJob/PageRangesDlgTest.java
java/awt/print/PrinterJob/PrintGlyphVectorTest.java
java/awt/print/PrinterJob/PrintLatinCJKTest.java
java/awt/print/PrinterJob/PrintTextTest.java
java/awt/print/PrinterJob/SwingUIText.java
java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
java/awt/PrintJob/SaveDialogTitleTest.java

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

Commit messages:
 - 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Changes: https://git.openjdk.java.net/jdk/pull/2756/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2756&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262470
  Stats: 725 lines in 5 files changed: 722 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2756.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2756/head:pull/2756

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Sergey Bylokhov-2
On Fri, 26 Feb 2021 19:40:22 GMT, Alexander Scherbatiy <[hidden email]> 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:
> java/awt/print/PrinterJob/GlyphPositions.java
> java/awt/print/PrinterJob/PSQuestionMark.java
>
> 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:
> java/awt/print/Dialog/DialogOrient.java
> java/awt/print/Dialog/DialogType.java
> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
> java/awt/print/PrinterJob/PageDialogTest.java
> java/awt/print/PrinterJob/PageRanges.java
> java/awt/print/PrinterJob/PageRangesDlgTest.java
> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
> java/awt/print/PrinterJob/PrintLatinCJKTest.java
> java/awt/print/PrinterJob/PrintTextTest.java
> java/awt/print/PrinterJob/SwingUIText.java
> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
> java/awt/PrintJob/SaveDialogTitleTest.java

I'll run the tests for this fix.

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Sergey Bylokhov-2
In reply to this post by Alexander Scherbatiy-2
On Fri, 26 Feb 2021 19:40:22 GMT, Alexander Scherbatiy <[hidden email]> 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:
> java/awt/print/PrinterJob/GlyphPositions.java
> java/awt/print/PrinterJob/PSQuestionMark.java
>
> 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:
> java/awt/print/Dialog/DialogOrient.java
> java/awt/print/Dialog/DialogType.java
> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
> java/awt/print/PrinterJob/PageDialogTest.java
> java/awt/print/PrinterJob/PageRanges.java
> java/awt/print/PrinterJob/PageRangesDlgTest.java
> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
> java/awt/print/PrinterJob/PrintLatinCJKTest.java
> java/awt/print/PrinterJob/PrintTextTest.java
> java/awt/print/PrinterJob/SwingUIText.java
> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
> java/awt/PrintJob/SaveDialogTitleTest.java

Marked as reviewed by serb (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Sergey Bylokhov-2
On Wed, 10 Mar 2021 01:48:28 GMT, Sergey Bylokhov <[hidden email]> 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:
>> java/awt/print/PrinterJob/GlyphPositions.java
>> java/awt/print/PrinterJob/PSQuestionMark.java
>>
>> 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:
>> java/awt/print/Dialog/DialogOrient.java
>> java/awt/print/Dialog/DialogType.java
>> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
>> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
>> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
>> java/awt/print/PrinterJob/PageDialogTest.java
>> java/awt/print/PrinterJob/PageRanges.java
>> java/awt/print/PrinterJob/PageRangesDlgTest.java
>> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
>> java/awt/print/PrinterJob/PrintLatinCJKTest.java
>> java/awt/print/PrinterJob/PrintTextTest.java
>> java/awt/print/PrinterJob/SwingUIText.java
>> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
>> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
>> java/awt/PrintJob/SaveDialogTitleTest.java
>
> Marked as reviewed by serb (Reviewer).

@prsadhuk please take a look

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Prasanta Sadhukhan-2
In reply to this post by Alexander Scherbatiy-2
On Fri, 26 Feb 2021 19:40:22 GMT, Alexander Scherbatiy <[hidden email]> 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:
> java/awt/print/PrinterJob/GlyphPositions.java
> java/awt/print/PrinterJob/PSQuestionMark.java
>
> 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:
> java/awt/print/Dialog/DialogOrient.java
> java/awt/print/Dialog/DialogType.java
> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
> java/awt/print/PrinterJob/PageDialogTest.java
> java/awt/print/PrinterJob/PageRanges.java
> java/awt/print/PrinterJob/PageRangesDlgTest.java
> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
> java/awt/print/PrinterJob/PrintLatinCJKTest.java
> java/awt/print/PrinterJob/PrintTextTest.java
> java/awt/print/PrinterJob/SwingUIText.java
> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
> java/awt/PrintJob/SaveDialogTitleTest.java

src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java line 1025:

> 1023:      * {@code GM_COMPATIBLE} or {@code GM_ADVANCED}.
> 1024:      */
> 1025:     private int setGraphicsMode(int mode) {

Is there any need of "int" return value? I dont see it is used in restoreTransform()

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Prasanta Sadhukhan-2
In reply to this post by Alexander Scherbatiy-2
On Fri, 26 Feb 2021 19:40:22 GMT, Alexander Scherbatiy <[hidden email]> 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:
> java/awt/print/PrinterJob/GlyphPositions.java
> java/awt/print/PrinterJob/PSQuestionMark.java
>
> 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:
> java/awt/print/Dialog/DialogOrient.java
> java/awt/print/Dialog/DialogType.java
> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
> java/awt/print/PrinterJob/PageDialogTest.java
> java/awt/print/PrinterJob/PageRanges.java
> java/awt/print/PrinterJob/PageRangesDlgTest.java
> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
> java/awt/print/PrinterJob/PrintLatinCJKTest.java
> java/awt/print/PrinterJob/PrintTextTest.java
> java/awt/print/PrinterJob/SwingUIText.java
> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
> java/awt/PrintJob/SaveDialogTitleTest.java

src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp line 2033:

> 2031:     xForm.eDy  = (FLOAT) elems[5];
> 2032:
> 2033:     ::SetWorldTransform((HDC)printDC, &xForm);

Probably we should check for the return value of all this system APIs SetGraphicsMode, GetWorldTransform, SetWorldTransform, ModifyWorldTransform to see if it succeeded?

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows [v2]

Alexander Scherbatiy-2
In reply to this post by Alexander Scherbatiy-2
> 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:
> java/awt/print/PrinterJob/GlyphPositions.java
> java/awt/print/PrinterJob/PSQuestionMark.java
>
> 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:
> java/awt/print/Dialog/DialogOrient.java
> java/awt/print/Dialog/DialogType.java
> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
> java/awt/print/PrinterJob/PageDialogTest.java
> java/awt/print/PrinterJob/PageRanges.java
> java/awt/print/PrinterJob/PageRangesDlgTest.java
> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
> java/awt/print/PrinterJob/PrintLatinCJKTest.java
> java/awt/print/PrinterJob/PrintTextTest.java
> java/awt/print/PrinterJob/SwingUIText.java
> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
> java/awt/PrintJob/SaveDialogTitleTest.java

Alexander Scherbatiy has updated the pull request incrementally with two additional commits since the last revision:

 - Use DASSERT to check SetGraphicsMode and WorldTransform results
 - Change setGraphicsMode() type to void

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/2756/files
  - new: https://git.openjdk.java.net/jdk/pull/2756/files/e0278acd..8105885f

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2756&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2756&range=00-01

  Stats: 21 lines in 2 files changed: 8 ins; 2 del; 11 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2756.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2756/head:pull/2756

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows [v2]

Alexander Scherbatiy-2
In reply to this post by Prasanta Sadhukhan-2
On Wed, 10 Mar 2021 09:31:32 GMT, Prasanta Sadhukhan <[hidden email]> wrote:

>> Alexander Scherbatiy has updated the pull request incrementally with two additional commits since the last revision:
>>
>>  - Use DASSERT to check SetGraphicsMode and WorldTransform results
>>  - Change setGraphicsMode() type to void
>
> src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java line 1025:
>
>> 1023:      * {@code GM_COMPATIBLE} or {@code GM_ADVANCED}.
>> 1024:      */
>> 1025:     private int setGraphicsMode(int mode) {
>
> Is there any need of "int" return value? I dont see it is used in restoreTransform()

I updated the code to return void from setGraphicsMode() method.

> src/java.desktop/windows/native/libawt/windows/awt_PrintJob.cpp line 2033:
>
>> 2031:     xForm.eDy  = (FLOAT) elems[5];
>> 2032:
>> 2033:     ::SetWorldTransform((HDC)printDC, &xForm);
>
> Probably we should check for the return value of all this system APIs SetGraphicsMode, GetWorldTransform, SetWorldTransform, ModifyWorldTransform to see if it succeeded?

I added DASSERT to check SetGraphicsMode and Get/Set/ModifyWorldTransform results.

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows [v2]

Prasanta Sadhukhan-2
In reply to this post by Alexander Scherbatiy-2
On Thu, 18 Mar 2021 12:29:01 GMT, Alexander Scherbatiy <[hidden email]> 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:
>> java/awt/print/PrinterJob/GlyphPositions.java
>> java/awt/print/PrinterJob/PSQuestionMark.java
>>
>> 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:
>> java/awt/print/Dialog/DialogOrient.java
>> java/awt/print/Dialog/DialogType.java
>> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
>> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
>> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
>> java/awt/print/PrinterJob/PageDialogTest.java
>> java/awt/print/PrinterJob/PageRanges.java
>> java/awt/print/PrinterJob/PageRangesDlgTest.java
>> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
>> java/awt/print/PrinterJob/PrintLatinCJKTest.java
>> java/awt/print/PrinterJob/PrintTextTest.java
>> java/awt/print/PrinterJob/SwingUIText.java
>> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
>> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
>> java/awt/PrintJob/SaveDialogTitleTest.java
>
> Alexander Scherbatiy has updated the pull request incrementally with two additional commits since the last revision:
>
>  - Use DASSERT to check SetGraphicsMode and WorldTransform results
>  - Change setGraphicsMode() type to void

Marked as reviewed by psadhukhan (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

Re: <AWT Dev> RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows [v2]

Sergey Bylokhov-2
In reply to this post by Alexander Scherbatiy-2
On Thu, 18 Mar 2021 12:29:01 GMT, Alexander Scherbatiy <[hidden email]> 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:
>> java/awt/print/PrinterJob/GlyphPositions.java
>> java/awt/print/PrinterJob/PSQuestionMark.java
>>
>> 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:
>> java/awt/print/Dialog/DialogOrient.java
>> java/awt/print/Dialog/DialogType.java
>> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
>> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
>> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
>> java/awt/print/PrinterJob/PageDialogTest.java
>> java/awt/print/PrinterJob/PageRanges.java
>> java/awt/print/PrinterJob/PageRangesDlgTest.java
>> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
>> java/awt/print/PrinterJob/PrintLatinCJKTest.java
>> java/awt/print/PrinterJob/PrintTextTest.java
>> java/awt/print/PrinterJob/SwingUIText.java
>> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
>> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
>> java/awt/PrintJob/SaveDialogTitleTest.java
>
> Alexander Scherbatiy has updated the pull request incrementally with two additional commits since the last revision:
>
>  - Use DASSERT to check SetGraphicsMode and WorldTransform results
>  - Change setGraphicsMode() type to void

Marked as reviewed by serb (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/2756
Reply | Threaded
Open this post in threaded view
|

<AWT Dev> Integrated: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Alexander Scherbatiy-2
In reply to this post by Alexander Scherbatiy-2
On Fri, 26 Feb 2021 19:40:22 GMT, Alexander Scherbatiy <[hidden email]> 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:
> java/awt/print/PrinterJob/GlyphPositions.java
> java/awt/print/PrinterJob/PSQuestionMark.java
>
> 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:
> java/awt/print/Dialog/DialogOrient.java
> java/awt/print/Dialog/DialogType.java
> java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
> java/awt/print/PrinterJob/ImagePrinting/ImageTypes.java
> java/awt/print/PrinterJob/ImagePrinting/PrintARGBImage.java
> java/awt/print/PrinterJob/PageDialogTest.java
> java/awt/print/PrinterJob/PageRanges.java
> java/awt/print/PrinterJob/PageRangesDlgTest.java
> java/awt/print/PrinterJob/PrintGlyphVectorTest.java
> java/awt/print/PrinterJob/PrintLatinCJKTest.java
> java/awt/print/PrinterJob/PrintTextTest.java
> java/awt/print/PrinterJob/SwingUIText.java
> java/awt/PrintJob/ConstrainedPrintingTest/ConstrainedPrintingTest.java
> java/awt/PrintJob/PageSetupDlgBlockingTest/PageSetupDlgBlockingTest.java
> java/awt/PrintJob/SaveDialogTitleTest.java

This pull request has now been integrated.

Changeset: 02287349
Author:    Alexander Scherbatiy <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/02287349
Stats:     731 lines in 5 files changed: 728 ins; 0 del; 3 mod

8262470: Printed GlyphVector outline with low DPI has bad quality on Windows

Reviewed-by: serb, psadhukhan

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

PR: https://git.openjdk.java.net/jdk/pull/2756