Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8343509

Certain code points fail to render properly in JavaFX

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      macOS Sonoma 14.7. Java 23.0.1. OpenJFX 23.0.1.

      A DESCRIPTION OF THE PROBLEM :
      JavaFX apps fail to properly render some characters. This includes single-codepoint characters like `𐀀`, LINEAR B SYLLABLE B008 A, at decimal codepoint 65.536. Despite every font on my Mac supporting this character, JavaFX apps display striped-box while the very same string appears correctly on the Java console.

      For screenshots and discussion, see Stack Overflow:
      https://stackoverflow.com/q/79127168/642706



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Build a string like this:

      String text =
              new StringBuilder ( )
                      .appendCodePoint ( 65_536 ) // 𐀀 = 65536 = LINEAR B SYLLABLE B008 A
                      .toString ( );

      Dump to console, where the text appears correctly.

      System.out.println ( text );

      Put that same text in a JavaFX `TextArea` where it appears incorrectly.

      There is already an unresolved bug report for characters composed of multiple codepoints such as man-facepalming 🤦‍♂️ = [129318, 8205, 9794, 65039]. But I filed this bug report for the case of a single codepoint simple character.
      https://bugs.openjdk.org/browse/JDK-8309565

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect to see that single character appear in the JavaFX UI:
      𐀀
      ACTUAL -
      Instead I see a striped box.

      ---------- BEGIN SOURCE ----------
      package work.basil.example.exunicodeglyph;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TextArea;
      import javafx.scene.layout.StackPane;
      import javafx.stage.Stage;

      import java.io.IOException;

      public class HelloApplication extends Application
      {
          @Override
          public void start ( Stage stage ) throws IOException
          {
              Scene scene = this.makeScene ( );
              stage.setTitle ( "Hello!" );
              stage.setScene ( scene );
              stage.show ( );
          }

          private Scene makeScene ( )
          {
              // Widgets
              TextArea textArea = new TextArea ( );
      String text =
              new StringBuilder ( )
                      .appendCodePoint ( 65_536 ) // 𐀀 = 65536 = LINEAR B SYLLABLE B008 A
                      .append ( "\n" )
                      .appendCodePoint ( 129_318 ) // 129_318 = 🤦 = FACE PALM
                      .append ( "\n" )
                      .append ( "🤦‍♂️" ) // man facepalming = 🤦‍♂️ = [129318, 8205, 9794, 65039]
                      .append ( "\n" )
                      .append ( "« fin »" )
                      .toString ( );
              System.out.println ( text );
              textArea.textProperty ( ).set ( text );

              // Arrange
              StackPane root = new StackPane ( );
              root.getChildren ( ).add ( textArea );
              return new Scene ( root , 320 , 240 );
          }

          public static void main ( String[] args )
          {
              HelloApplication.launch ( );
          }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      None.

      FREQUENCY : always


            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: