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

Word wrapping not working properly for continuous text with Indic characters on QTextEdit when using conjunct/half-forms/virama forms of a character

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 4.8.2
    • GUI: Text handling
    • None
    • Windows XP SP3, x86 Intel, QT 4.8.2 open source version, with MinGW GCC 4.6.2, QT Creator 2.5.0

    Description

      Word wrapping is not working properly when the virama character - unicode 0x94d is used, for hindi. This problem exists for other indic character sets too that have their own virama representation, for e.g tamil etc. A virama character is used to produce the half form representation of a full character.

      for e.g. क + 0x94D (virama unicode) = क्

      when a continuous text of "क्" is created like "क्क्क्क्कक्क्क्क्कक्क्क्क्क्" the wrapping fails.

      Wrapping works properly for roman characters like english etc.

      Wrapping also works when the 0x94D virama character is not used, that is when the full form of a indic character is used.

      for e.g. in the following case "ककककककककककककककककककक"

      The following code demonstrates this issue

      #include <QApplication>
      #include <QtGui>

      int main(int argc, char *argv[])
      {
      QApplication a(argc, argv);

      QTextEdit edit;
      edit.document()->setDefaultFont(QFont("Arial", 16));
      edit.setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);

      edit.setFixedSize(200, 200);

      QString nagari;
      QString english;

      for (int i = 0; i < 100; i++)

      { nagari += QChar(0x915) + QString(0x94D); english += 'A'; }

      /*
      // THis wraps correctly, its not using the nagari virama char -0x94D
      for (int i = 0; i < 100; i++)

      { nagari += QChar(0x915); english += 'A'; }

      */

      edit.setText(nagari + "\n\n" + english);
      edit.show();

      return a.exec();
      }

      This is a very crucial issue because for languages such as sanskrit, a word can often be represented as a very long and continuous compound word, and this wrapping bug will cause the word to flow out of the screen/widget. Also when the same word is translated into other script like tamil, telugu, kannada etc, it will cause the same issue.

      This affects all indic languages that use virama for half-forms. Viz. hindi, marathi, gujarati, nepali, tamil, telugu, kannada, malayalam, sinhala etc.

      Sample code/Screenshot attached.

      Attachments

        1. shot.bmp
          1.76 MB
          Ram
        2. WrapBug.zip
          471 kB
          Ram
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            tarkshya Ram
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes