> There is a bug in `TextLayout.getOutline(AffineTransform)`, where the > transformation is applied too early (before the layout path applies its > mapping). The most obvious error caused by this bug is that > `Graphics2D.drawString(...)` fails to draw the string when using a rotated + > scaled `AffineTransform` (see minimal test case in the bug report). > > There are two uses of `TextLayout.getOutline(AffineTransform)`: the first > one, triggered via a simple `Graphics2D.drawString(...)` was the one I ran > into; the second one requires the use of a transformed font with a > `PSPrinterJob`. Both are broken. This PR includes two test classes verifying > that both scenarios were broken before the fix and are working after the fix. > > Two points which might require some discussion: > 1. I've changed the signature of method > `TextLine.getOutline(AffineTransform)`, to just `TextLine.getOutline()`; I'm > assuming this is OK since `TextLine` is a package-private class. > 2. I've added a fast path in `TextLayout.getOutline(AffineTransform)` to > transform the shape in place if it is a `GeneralPath` (it should usually be, > and avoids an extra `Shape` copy vs. the current code, which makes no copy). > A bit more complex, but efficient.
Daniel Gredler has updated the pull request incrementally with one additional commit since the last revision: Add info to test failure messages, increase allowed variance ------------- Changes: - all: https://git.openjdk.org/jdk/pull/20993/files - new: https://git.openjdk.org/jdk/pull/20993/files/a6081981..3a2613fd Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=20993&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=20993&range=01-02 Stats: 12 lines in 2 files changed: 6 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/20993.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/20993/head:pull/20993 PR: https://git.openjdk.org/jdk/pull/20993