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

Text renders RTL text backwards sometimes.

XMLWordPrintable

      The following test case shows two Text nodes with the three first letters in the Hebrew alphabet. The first node incorrectly shows the characters rendered from left-to-right (though not mirrored).

      The second node consists of two lines, and this node displays both lines correctly.

      See attached image.

      import javafx.application.*;
      import javafx.scene.*;
      import javafx.scene.layout.*;
      import javafx.scene.text.*;
      import javafx.stage.*;

      public class Hebrew extends Application {

          public static void main(String[] args) { launch(args); }

          @Override public void start(Stage stage) {
              VBox rootNode = new VBox(10);
              rootNode.setStyle("-fx-padding: 20;");

              Text text = new Text();
              text.setText("\u05D0\u05D1\u05D2"); // alef bet gibel
              rootNode.getChildren().add(text);

              text = new Text();
              text.setText("\u05D0\u05D1\u05D2\n\u05D0\u05D1\u05D2"); // Two lines
              rootNode.getChildren().add(text);

              Scene scene = new Scene(rootNode);
              stage.setScene(scene);
              stage.show();
          }
      }

        1. Bug.png
          0.7 kB
          Leif Samuelsson

            fheidric Felipe Heidrich (Inactive)
            leifs Leif Samuelsson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: