RFR: 8350203: [macos] Newlines and tabs are not ignored when drawing text to a Graphics2D object [v2]
Harshitha Onkar
honkar at openjdk.org
Wed May 7 23:22:04 UTC 2025
On Wed, 7 May 2025 22:23:02 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.
>
> Daniel Gredler has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>
> - Merge branch 'master' into ignored-whitespace
> - Make Graphics2D.drawString ignore tabs and newlines on macOS
> - Add actual bug ID
> - Add ignored whitespace test
> As an example, this fix addresses the screen display side of things for macOS, but printing on macOS needs to be fixed separately (as can be seen when you run test/jdk/java/awt/print/PrinterJob/PrintTextTest.java). I had a quick look at the corresponding macOS printing issue a few months ago and the fix wasn't obvious, especially given how that part of the code is organized (not really 1-to-1 with the other platforms).
I agree it was not as straightforward to see where to add the fix for windows and linux platforms.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23665#issuecomment-2860675664
More information about the client-libs-dev
mailing list