RFR: 8148334: The regression case:java/awt/print/PrinterJob/PrintTextTest.java failed as the Printed pages do not match the shown Page.

Daniel Gredler duke at openjdk.org
Fri Nov 8 14:50:01 UTC 2024


This PR fixes the issue identified in JDK-8148334 in screenshots `Page8_landscape.JPG` and `Page8_portrait.JPG`.

It does not address `mac_Page1.png` or `mac_Page8.png`, which I'm not even sure are still issues (I have no access to a Mac).

The method in question, `PathGraphics.printedSimpleGlyphVector(...)` is quite complex, with many special cases being handled in different ways. In this specific scenario (page 8 of `PrintTextTest`), all special case checks fail, and we fall through all the way to the final handling block, which draws the individual characters one by one. It looks like the problem is that the font transform translation is applied twice, once via the glyph positions, and again by `drawString(...)` via the font. The proposed fix is to provide `drawString(...)` a font without any translation transform.

Testing looks good on Linux, but needs to be done on Mac and Windows.

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

Commit messages:
 - Avoid applying font translation transform twice in some scenarios

Changes: https://git.openjdk.org/jdk/pull/21980/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21980&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8148334
  Stats: 15 lines in 1 file changed: 13 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/21980.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21980/head:pull/21980

PR: https://git.openjdk.org/jdk/pull/21980


More information about the client-libs-dev mailing list