[Linux] JavaFX is displaying unicode characters incorrectly

Thiago Milczarek Sayão thiago.sayao at gmail.com
Thu Feb 22 10:47:43 UTC 2024


Hi,

This possible bug is reported here:
https://bugs.openjdk.org/browse/JDK-8322251

Running the code bellow produces incorrect text on Ubuntu 24.04 (still not
released). I would like to fix it, but some hints would be appreciated.

I might be missing a font, but the same text render fine on GTK based
applications.

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

public class TextAreaSample extends Application {

    @Override
    public void start(Stage primaryStage) {
        TextArea textArea = new TextArea();
        textArea.setText("你好,世界");

        StackPane root = new StackPane();
        root.getChildren().add(textArea);

        Scene scene = new Scene(root, 300, 200);
        primaryStage.setTitle("Test");
        primaryStage.setScene(scene);

        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(TextAreaSample.class, args);
    }
}


Ubuntu 22.04
[image: image.png]

Ubuntu 24.04 (nightly build):
[image: image.png]

-- Thiago


import javafx.application.Application;
import javafx.scene.Scene;

import javafx.scene.control.TextArea;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class TextAreaSample extends Application {

    @Override
    public void start(Stage primaryStage) {
        TextArea textArea = new TextArea();
	textArea.setText("你好,世界");

        StackPane root = new StackPane();
        root.getChildren().add(textArea);

        Scene scene = new Scene(root, 300, 200);
        primaryStage.setTitle("Test");
        primaryStage.setScene(scene);

        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(TextAreaSample.class, args);
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240222/cde70685/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 6227 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240222/cde70685/image-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 3682 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20240222/cde70685/image-0003.png>


More information about the openjfx-dev mailing list