Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104669

Concatenation of LTR + RTL texts is broken

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.15.3, 5.15.7
    • None
    • Ubuntu 20.04
    • Linux/X11

    Description

      In case if concatenate text on Hebrew language with English regular text which contains letters - output will be broken.
      Please take a look on video - first like just concatenation, second like "\u200f" symbol is put before RTL text starts (to fix this issue), third one just Hebrew language.

      In case if there is symbols like double dot or bracket or number and no letters - text will be correctly reversed.
      In case if there is only Hebrew text - text also will be correctly reversed.
      In case if there is some English letter - text will be messed (please compare lines on video).

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtQuick.Controls 2.15
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Item {
              id: textItem
              width: 640
              height: 480
              readonly property string hebrewText1: "26 דק'"
              readonly property string hebrewText2: "25 ק\"מ"
              readonly property var ltrTexts: ["1", "s", "1:", "10:10 am", "()", "1p"]
              property int ltrTextsIndex: 0
              Text {
                  id: buggyText
                  anchors.top: textItem.top
                  anchors.margins: 20
                  text: "%1, %2, %3".arg(textItem.ltrTexts[textItem.ltrTextsIndex]).arg(textItem.hebrewText1).arg(textItem.hebrewText2)
              }
      
              Text {
                  id: fixedText
                  anchors.margins: 20
                  anchors.top: buggyText.bottom
                  text: "%1, \u200f%2, %3".arg(textItem.ltrTexts[textItem.ltrTextsIndex]).arg(textItem.hebrewText1).arg(textItem.hebrewText2)
              }
      
              Text {
                  id: withoutLtrText
                  anchors.top: fixedText.bottom
                  anchors.margins: 20
                  text: "%1, %2".arg(textItem.hebrewText1).arg(textItem.hebrewText2)
              }
      
              Button {
                  anchors.top: withoutLtrText.bottom
                  anchors.topMargin: 50
                  onClicked: {
                      if (textItem.ltrTextsIndex < (textItem.ltrTexts.length - 1)) {
                          textItem.ltrTextsIndex += 1;
                      } else {
                          textItem.ltrTextsIndex = 0;
                      }
                  }
              }
          }
      }
      
      

      Attachments

        1. reordered.png
          reordered.png
          92 kB
        2. snapshot.png
          snapshot.png
          39 kB
        3. vokoscreen-2022-06-30_13-04-25.mkv
          543 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            dmartyniuk Dmytro Martyniuk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes