RFR: 8350203: [macos] Newlines and tabs are not ignored when drawing text to a Graphics2D object

Harshitha Onkar honkar at openjdk.org
Thu May 1 18:40:49 UTC 2025


On Mon, 17 Feb 2025 14:06:53 GMT, Daniel Gredler <dgredler at openjdk.org> wrote:

> On other platforms like Windows and Linux, the `\n`, `\r` and `\t` characters are ignored when drawing text to a `Graphics2D` object. On macOS this is not currently the case.
> 
> See, for example, `CMap.getControlCodeGlyph(int, boolean)` or `RasterPrinterJob.removeControlChars(String)`.
> 
> This bug was found while running `test/jdk/java/awt/print/PrinterJob/PrintTextTest.java` on macOS.
> 
> The new test class passes on Linux, Windows and macOS.

@gredler Tested your fix by applying your changes on top of harfbuzz upgrade - https://github.com/openjdk/jdk/pull/24973 . Initial testing of your fix with IgnoredWhitespaceTest.java test and NLGlyphTest.java looks good. I haven't done a full fledged testing yet.

This PR fixes the same issue observed on another test - `java/awt/font/TextLayout/TestControls.java` - [JDK-8353187](https://bugs.openjdk.org/browse/JDK-8353187). You can link the additional JBS ID to this PR with `/issue add 8353187`

I will be integrating harfbuzz upgrade PR soon after which you can sync your branch with mainline to test it on your end.

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

PR Review: https://git.openjdk.org/jdk/pull/23665#pullrequestreview-2810426871


More information about the client-libs-dev mailing list