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

Wrong richtext rendering with RTL text

    XMLWordPrintable

Details

    Description

      Hi, rich text renderings with RTL languages are partially broken, elements aren't correctly decorate if the text string begins with rtl characters (which makes the text rendering RTL ), however its fine when the text starts with LTR characters (which makes the rendering LTR).

      Take look at these codes

       

      1. all LTR chars (Correct) :

      import QtQuick 2.9
      
      Text {
         textFormat: Qt.RichText
         text: "<p>Hello<img src=\"https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/png/1f600.png\" width='50' height='50'>How are you</p>"
         font.pixelSize: 50
      
      }
      
      

       

      2. Start with LTR and ends with RTL chars (Correct)

      import QtQuick 2.9
         
      Text {
          textFormat: Qt.RichText
          text: "<p>Hello<img src=\"https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/png/1f600.png\" width='50' height='50'>خوبی؟</p>"
          font.pixelSize: 50
      }
      

       

       

      3. All RTL chars (Wrong):

      import QtQuick 2.9
         
      Text {
          textFormat: Qt.RichText
          text: "<p>سلام <img src=\"https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/png/1f600.png\" width='50' height='50'>خوبی؟</p>"
          font.pixelSize: 50
      }
      

      as you can see, two words "سلام" and "خوبی" are separated by emoji picture, but the text renderer joins them together!

       

       

      4. Starting with RTL and ending with LTR (Wrong):

      import QtQuick 2.9
         
      Text {
          textFormat: Qt.RichText
          text: "<p>سلام <img src=\"https://cdnjs.cloudflare.com/ajax/libs/emojione/2.2.7/assets/png/1f600.png\" width='50' height='50'>Hello How Are you</p>"
          font.pixelSize: 50
      }
      

       

      PS: How i can attach images here? the JIRA tells me about missing tokens and dont' let me upload pictures here

       

      Attachments

        1. 1.png
          1.png
          12 kB
        2. 2.png
          2.png
          8 kB
        3. 3.png
          3.png
          8 kB
        4. 4.png
          4.png
          14 kB
        5. 4.png
          4.png
          14 kB

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              e.jahandar Ebrahun Jahandar
              Votes:
              4 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes