RFR: 8357672: Extreme font sizes can cause font substitution

Jayathirth D V jdv at openjdk.org
Mon Jun 2 11:24:53 UTC 2025


On Wed, 28 May 2025 20:19:42 GMT, Phil Race <prr at openjdk.org> wrote:

> Instrumenting the existing ExtremeFontSizeTest.java, it was noted that the freetype code, when encountering a null return from getting a scaler context, would over-interpret this as a bad font.
> The test was intended to check this wasn't happening by verifying metrics before and after using extreme sizes.
> But the scenaro was not being detected by the test because a replacement font was substituted and it did not have zero metrics.
> So the updated test checks that the metrics before and after are the same.
> This new version of the test failed on Linux before the JDK source updates and passes afterwards.

Apart from the added query, Change LGTM.

test/jdk/java/awt/FontMetrics/ExtremeFontSizeTest.java line 39:

> 37: /*
> 38:  * @test
> 39:  * @bug 8328896 8357672

I thought Freetype rasterizer is used on all platforms(Linux, Windows & macOS) by default. Since Freetype is part of JDK.

When i run this test on macOS without any updates from this PR on baseline code, i see that all Fontmetrics in System.out() are non-zero and match before and after extreme parameters. Is this behaviour okay?

I was expecting mismatch in FontMetrics on macOS also.
If this test is supposed to catch issues on particular platforms. Do we need to make it specific to some platforms?

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

Marked as reviewed by jdv (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25511#pullrequestreview-2887934023
PR Review Comment: https://git.openjdk.org/jdk/pull/25511#discussion_r2120839304


More information about the client-libs-dev mailing list