JDK-8353230 : Emoji rendering regression after JDK-8208377
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 25
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-03-30
  • Updated: 2025-06-18
  • Resolved: 2025-05-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25
25 b26Fixed
Related Reports
Causes :  
Causes :  
Description
The following example of emoji rendering doesn't work correctly after the changes in JDK-8208377 (Soft hyphens render if not using TextLayout).

(The repro requires downloading the font from https://github.com/googlefonts/noto-emoji/blob/main/fonts/NotoColorEmoji-emojicompat.ttf to the working directory.)

```
import java.awt.Font;
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.nio.file.Files;
import java.nio.file.Path;

public final class T {

  private static final String WOMAN = "\ud83d\udc71\ud83c\udffd\u200d\u2640\ufe0f";
  private static final String ASTRONAUT = "\ud83d\udc69\ud83c\udffc\u200d\ud83d\ude80";
  private static final String FAMILY = "\ud83d\udc69\u200d\ud83d\udc69\u200d\ud83d\udc67";

  // https://github.com/googlefonts/noto-emoji/blob/main/fonts/NotoColorEmoji-emojicompat.ttf
  private static final Path font = Path.of("NotoColorEmoji-emojicompat.ttf");

  public static void main(String[] args) throws Exception {
    test(WOMAN);
    test(ASTRONAUT);
    test(FAMILY);
  }

  static void test(String text) throws Exception {
    GlyphVector glyphVector = getGlyphVector(text);
    if (glyphVector.getNumGlyphs() != 1) {
      throw new AssertionError();
    }
  }

  private static GlyphVector getGlyphVector(String text) throws Exception {
    FontRenderContext frc = new FontRenderContext(null, true, true);
    return Font.createFont(Font.TRUETYPE_FONT, Files.newInputStream(font))
        .layoutGlyphVector(frc, text.toCharArray(), 0, text.length(), Font.LAYOUT_LEFT_TO_RIGHT);
  }
}
```

$ java -fullversion
openjdk full version "25-ea+16-1816"
$ java T
Exception in thread "main" java.lang.AssertionError
        at T.test(T.java:25)
        at T.main(T.java:17)
Comments
Changeset: 94039e22 Branch: master Author: Daniel Gredler <dgredler@openjdk.org> Committer: Harshitha Onkar <honkar@openjdk.org> Date: 2025-05-30 19:16:17 +0000 URL: https://git.openjdk.org/jdk/commit/94039e22bbe943888e858d8ae278145e2668526a
30-05-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/24412 Date: 2025-04-03 11:23:42 +0000
03-04-2025

That's what I was afraid of -- I'll look at creating a custom minimal font for the reproducer.
01-04-2025

Short answer : the process is very heavyweight and done only for critical needs and comes with a maintenance burden.
31-03-2025

Thanks for the heads up, looking at this now. In the meantime, is there a process for including open source test resources (like the OFL-1.1-licensed font referenced in the bug report) in the OpenJDK tests?
31-03-2025