On Mon, 17 Feb 2025 14:06:53 GMT, Daniel Gredler <dgred...@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. I am seeing an existing test fail on macOS with this change java/awt/font/GlyphVector/NLGlyphTest.java java NLGlyphTest Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0 at java.desktop/sun.font.StandardGlyphVector.getGlyphCode(StandardGlyphVector.java:311) at NLGlyphTest.main(NLGlyphTest.java:46) This code char[] chs = { '\n' }; GlyphVector lgv = font.layoutGlyphVector(frc, chs, 0, 1, 0); results in a GV with zero glyphs, which isn't what I'd expect - that a string would have no glyphs at all. Interestingly I think it is OK for some fonts, but not OK for most fonts. ------------- PR Comment: https://git.openjdk.org/jdk/pull/23665#issuecomment-2705094639