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

Certain characters in Text node prevent later characters from rendering

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx11, jfx20, 8, jfx17, jfx21, jfx22
    • javafx
    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      OpenJDK 22-ea+12
      OpenJFX 22-ea+6
      Bug has been present since at least OpenJFX 17.0.1

      A DESCRIPTION OF THE PROBLEM :
      Certain characters (such as `த` or `ம` from the Tamil alphabet), when followed by a large number of characters without line breaks in the same `Text` node, break the rendering of later characters in the same line and `Text` node.

      For example, when a `Text` node has contents `"த" + "a".repeat(32_001)`, the Text node only renders as `த`. When the number of characters following `த` is reduced to 32,000, then the paragraph renders correctly.

      The bug still occurs when there is whitespace after `த`, only the number at which the bug occurs is slightly different. Inserting ASCII characters at the start of the paragraph doesn't appear to change anything.

      `文` is a non-ASCII character that doesn't trigger the bug, but the behaviour is a bit different when it is used instead of `a`. For example, `"த" + "文".repeat(32_001) + "b"` renders as `தb`, but `"த" + "a".repeat(32_001) + "b"` renders as `த`.

      The bug affects `TextArea`s as well. You may find more information here, where I first reported the bug before seeing it was caused by the `Text` node: https://github.com/FXMisc/RichTextFX/issues/1188

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run `Launcher.main()` in the code below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      `த` followed by a long sequence of `a`s is displayed.
      ACTUAL -
      `த` is displayed with no `a`s.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.ScrollPane;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      public class TextCutOffBug extends Application {

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

      @Override
      public void start(Stage stage) {
      String text = "த" + "a".repeat(32_001);
      Text textNode = new Text(text);
      Scene scene = new Scene(new ScrollPane(textNode), 500, 300);
      stage.setScene(scene);
      stage.show();
      }

      public static class Launcher {
      public static void main(String[] args) {
      TextCutOffBug.main(args);
      }
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The bug only appears to occur when a `Text` node has over 32,000 characters. So a workaround is to use multiple `Text` nodes each with 32,000 characters or fewer instead of a single node.

      FREQUENCY : always


        1. Capture1.PNG
          Capture1.PNG
          68 kB
        2. Capture2.PNG
          Capture2.PNG
          67 kB
        3. TextCutOffBug.java
          0.8 kB

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

              Created:
              Updated: