On Wed, 2 Sep 2026 13:14:58 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).

This pull request has now been integrated.

Changeset: dbab828d
Author:    Jayathirth D V <[email protected]>
URL:       
https://git.openjdk.org/jdk/commit/dbab828dd864feebaa3007890cbd4a97e33ca106
Stats:     145 lines in 3 files changed: 124 ins; 18 del; 3 mod

8349701: TrueType fonts are rendered incorrectly in VolatileImage with Metal
8367873: Tooltips Are Distorted When Frame Is Fullscreen on a HiDPI Display

Reviewed-by: aghaisas, prr

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

PR: https://git.openjdk.org/jdk/pull/32651

Reply via email to