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

cursor is not getting position correctly when U+200D comes in syllable

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.8.0
    • 4.7.0
    • GUI: Font handling
    • None
    • 0189fc2335c891373ce595a4a01e4a9d73cc5fe4

    Description

      open kwrite, konqueror

      type:

      0x0915 0x094d 0x200d 0x0915 "क्‍क"

      observe cursor position, it is not coming at the end of syllable, so if we type any next character it get merged with last character of this syllable, creating a major problem

      i have noticed this problem, when fixed QTBUG-13616, this is common problem whenever U+200D come in syllable

      i have not much clear idea, why it is occurring, but when we remove control characters in harfbuzz-indic.c, this problem occurs

              if (control) {
                  IDEBUG("found a control char in the syllable");
                  hb_uint32 i = 0, j = 0;
                  while (i < item->num_glyphs) {
                      if (form(reordered[otl_glyphs[i].cluster]) == Control) {
                          ++i;
                          if (i >= item->num_glyphs)
                              break;
                      }
                      item->glyphs[j] = item->glyphs[i];
                      item->attributes[j] = item->attributes[i];
                      ++i;
                      ++j;
                  }
                  item->num_glyphs = j;
              }
      

      Here's an example to reproduce the problem:

      #include <QtGui>
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          QString s;
          s.append(QLatin1Char('"'));
          s.append(QChar(0x0915));
          s.append(QChar(0x094d));
          s.append(QChar(0x200d));
          s.append(QChar(0x0915));
          s.append(QLatin1Char('"'));
      
      
          QTextEdit textEdit;
          textEdit.setPlainText(s);
          textEdit.show();
      
          QFont font = app.font();
          font.setPointSizeF(48);
          textEdit.setFont(font);
      
          return app.exec();
      }
      

      Notice that the last quote-symbol is painted on top of the syllable, and when moving the cursor using the keyboard, it's placed in the middle of the syllable instead of at the end. Try copy pasting the same text into e.g. WordPad (CTRL+A, CTRL+C) to see the correct shaping and cursor movement for the text.

      Attachments

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

        Activity

          People

            jiang Jiang Jiang
            pravins Pravin Satpute
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes