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

Arabic text is clipped when alignment is not set "right"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 4.8.0
    • 4.7.3
    • GUI: Text handling
    • None
    • 1a8a36eb6b6df9e2550b5eaa4606f2d411fd4294

    Description

      Sauer Sebastian comment in bug 217191:

      The remaining issue is a Qt bug. Compared to the previous solution we have no
      way to work around that Qt bug cause Qt doesn't expose the needed informations
      to us[*]. So, this needs to be fixed within Qt scribe (QTextDocument,
      QTextLayout and friends). The attached demo-application is a small 70-lines
      PyQt python-script that demonstrates the problem in a Qt-only application[**].

      [*] We would need the value that is added to QTextLine.naturalTextWidth() if
      QTextOption::IncludeTrailingSpaces in the QTextLayout::textOption is set. This
      would allow us to to the alignment ourself / adjust the QTextLine's position to
      not cutoff right-to-left text.

      [**] Please install PyQt (or PySide) and execute the attached main.py. There
      are 2 bugs;

      1. Switch between "right" and "justify" alignment by pressing the matching
      buttons. See that the text is partly cutoff on the right side on "justify"
      while it looks fine on "right" alignment. This is the problem we can see with
      the attached withArabicText.docx document.

      2. Switch again the "right" alignment. Place the text-cursor at the beginning
      of the second line (that means right before the "تتيح"). Now press the
      space-key ~20 times. Everything looks as expected and the additional spaces are
      added to the left while the text stays proper right aligned. No text is
      cut-off. Now switch to "justify" alignment and see that the spaces are now
      responsible for cutting off the right side of the second line. Text is partly
      cutoff now. That text is cutoff on "left", "center" and "justify" alignment
      while it's correct with "right" alignment.

      We where able to work around the 2th case (that was fixed with commit
      3c1e0bdc10) but we have no way to work around the 1st case (cause the Qt-API
      doesn't allow so). Also the workaround added for the 2th case is rather dirty
      and it's probably in conflict with anything we could try to make the 1st case
      less worse.

      Attachments

        1. main.py
          3 kB
        2. testarabic.tar
          30 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            pironato Stefano Pironato
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes