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

Labeled: Truncation Fails With Grapheme Clusters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx21
    • javafx
    • None

      When textOverrun is set to (any) ellipsis, and the text contains grapheme clusters, the code in Utils.computeClipped* methods breaks grapheme clusters (see the screenshots).

      Steps to reproduce:

      - use the updated MT https://github.com/andy-goryachev-oracle/MonkeyTest
      - set text: emojis
      - set wrap text off
      - set text overrun to either CENTER_ELLIPSIS, CENTER_WORD_ELLIPSIS, LEADING_ELLIPSIS, LEADING_WORD_ELLIPSIS, or WORD_ELLIPSIS. (Curiously, ELLIPSIS works fine)
      - make sure Region properties (min/max/pref) (width/height) are set to USE_COMPUTED_SIZE
      - resize the viewport to truncate the label text.
      The truncation algorithm does not take into account grapheme clusters (where a glyph consists of more that one character), inserting the ellipsis string in the middle of the cluster, breaking it. As a result, various weird characters appear next to the ellipsis string.

      References:
      LabeledSkinBase:1105
      Utils.computeClippedWrappedText()
      Utils.computeClippedText()

            Unassigned Unassigned
            angorya Andy Goryachev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: