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.

Looking across the code base, there are a number of places which look 
explicitly for 0xFFFF (INVISIBLE_GLYPH_ID) and somewhat fewer that look for >= 
0xFFFE (INVISIBLE_GLYPHS) That's an interesting inconsistency in itself.
Also looking for 0xffff literals across the codebase is unsurprisingly tedious 
.. 

The idea of 0xFFFE might be worth a shot but it maybe that we need to make a 
bunch of changes to code that looks just for  INVISIBLE_GLYPH_ID, including in 
some tests, but it also might be that since this is macOS specific that it 
could be less risky - although since the result could still be used by shared 
code it isn't quite as constrained as you might hope.

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

PR Comment: https://git.openjdk.org/jdk/pull/23665#issuecomment-2707121017

Reply via email to