On Fri, 4 Sep 2026 06:19:30 GMT, Jayathirth D V <[email protected]> wrote:
>> Issue: When we render text using a TrueTypeFont and LCD mode, the rendered >> text is corrupted with Metal pipeline on macOS. >> >> Root cause: When FreeType rasterizes the LCD glyphs for TrueTypeFont it adds >> padding bytes >> https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/native/libfontmanager/freetypeScaler.c#L1033. >> So glyph width and rowBytes are not same, and when we convert this LCD >> Glyph into BGRA data in MTLTextRenderer.m we are not considering this >> padding and it corrupts the text. >> >> Fix: Use rowBytes information instead of width for LCD glyph and fill BGRA >> data with proper offsets. I have also removed initialization of BGRA array >> to 0, because we fill these arrays completely without any conditions. >> >> Initially i was thinking of manual test but using already present 'A.ttf' >> test font file in JDK, i am able to capture this LCD text corruption and >> create an automated test. I have kept this test generic and to run on >> default pipeline on all platforms, if not needed i can make the test macOS >> and Metal specific. The generic test runs fine in CI pipeline. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Jayathirth D V has updated the pull request incrementally with one additional > commit since the last revision: > > Initialize index variable Marked as reviewed by aghaisas (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/32651#pullrequestreview-5129961712
