RFR: 8378623: Use unique font names in FormatCharAdvanceTest

Jayathirth D V jdv at openjdk.org
Wed Feb 25 11:04:50 UTC 2026


While working on [JDK-8373290](https://bugs.openjdk.org/browse/JDK-8373290), it is noticed that with FreeType update java/awt/font/TextLayout/FormatCharAdvanceTest.java is failing.

On more analysis it is found that this Test is not using appropriate FontMetrics under FontMetrics.stringWidth() and Font.getStringBounds("AB", frc) code path. Test continues to use Type1 FontMetrics for TTF font.

Freetype update just revealed this issue as "width" slightly changes between the Type1 and TTF font used in this test(This is happening because of hinting/rounding change in FreeType update). We are not seeing any change of Metrics for other Physical(Helvetica.ttf) or Logical(Dialog) fonts.

We have separate bug [JDK-8378622](https://bugs.openjdk.org/browse/JDK-8378622) to analyse and fix FontMetrics caching issue. We are updating FormatCharAdvanceTest to use unique "font name" for both Type1 and TTF font to pick valid FontMetrics and make this test work properly. Changing the font name will not affect the purpose of this test.

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

Commit messages:
 - 8378623: Use unique font names in FormatCharAdvanceTest

Changes: https://git.openjdk.org/jdk/pull/29910/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29910&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8378623
  Stats: 20 lines in 1 file changed: 5 ins; 0 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/29910.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29910/head:pull/29910

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


More information about the client-libs-dev mailing list