On Sat, 14 Feb 2026 16:13:27 GMT, Daniel Gredler <[email protected]> wrote:
> On macOS, `GlyphMetrics` advance provides only the x-component of the > advance, not the y-component. This is usually not an issue, since most text > does not have any y-component advance. However, if the font is rotated, this > does cause problems. > > This bug was discovered during fixing of the manual test > `java/awt/print/PrinterJob/PrintTextTest.java` (this test is intended to test > printing, but this bug was actually causing the `GlyphVector`s on page 8 to > be drawn incorrectly on screen, not just on paper). > > `FileFontStrike.getGlyphMetrics( )` was helpful as a guide regarding the > expected behavior of `CStrike.getGlyphMetrics( )`. > > Tested on mac, Linux and Windows: > - make test TEST="jtreg:test/jdk/java/awt/font" > - make test TEST="jtreg:test/jdk/java/awt/Graphics2D/DrawString" The [FileFontStrike.getGlyphMetrics( )](https://github.com/openjdk/jdk/blob/497dca2549a9829530670576115bf4b8fab386b3/src/java.desktop/share/classes/sun/font/FileFontStrike.java#L802) has a check `if (glyphPtr != 0L)` before calling `StrikeCache.getGlyphXAdvance`. Do not we need the same check in the new code? I am not sure that getGlyphImagePtr always return non-0 value. Another difference is handing invisible INVISIBLE_GLYPHS, which I assume works fine on macOS as is. ------------- PR Comment: https://git.openjdk.org/jdk/pull/29726#issuecomment-3941617536
