New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8256264: Printed GlyphVector outline with low DPI has bad quality on Windows #1183
8256264: Printed GlyphVector outline with low DPI has bad quality on Windows #1183
Conversation
|
@AlexanderScherbatiy The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
I am not sure that we need the additional property for things other than possibly to workaround some possible bugs. I am fine if we will use the scaled version all the time, does it have any drawbacks? |
I prepared a simple print test sample which uses 4 different fonts (plain and bold) with different sizes and prints 640 lines on 10 pages. I run the sample with and without the fix to PDF and measured the time which is used by the deviceFill() method (it both converts the shape to path and fills it):
The average time without the fix: 2.77s (min 2.74s, max 2,78) I removed the |
You forgot to delete it from the test. |
…athPrecisionScaleFactorTest
The |
@AlexanderScherbatiy This change now passes all automated pre-integration checks. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 378 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.
|
/integrate |
@AlexanderScherbatiy Since your change was applied there have been 378 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit d6dd440. |
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.
To reproduce the issue run the PrintGlyphVectorOutlineSample file on Windows and select a low DPI
printer in the printer dialog. The sample prints two lines, one using Graphics drawString() method and another by
filling GlyphVector outline. Chars on the second line are distorted.
It is also possible to reproduce the issue running the sample and printing the text to PDF: fill-glyph-vector-outline.png
The proposed fix introduce "sun.java2d.print.enablePathPrecisionScale" property which being enabled
scales the GDI WorldTransform down and GlyphVector outline coordinates up.
This allows to keep some digits after a dot from being rounded.
The value for scaling is chosen to be 1000 in the same way how it is used by
String trunc(float f)
method from PSPrinterJob class on Linux:jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java
Line 1489 in ed615e3
See the fill-glyph-vector-outline-enable-path-scale-factor.png screenshot which shows how the GlyphVector outline is filled after the fix with the enabled "sun.java2d.print.enablePathPrecisionScale" option.
fill-glyph-vector-outline-diff.png shows difference of GlyphVector outline printing before and after the fix.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1183/head:pull/1183
$ git checkout pull/1183