[OpenJDK 2D-Dev] RFR: 8262470: Printed GlyphVector outline with low DPI has bad quality on Windows [v2]
Alexander Scherbatiy
alexsch at openjdk.java.net
Thu Mar 18 12:29:01 UTC 2021
> 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
More information about the 2d-dev
mailing list