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

QTextLine::setNumColumns() fails sometimes

    XMLWordPrintable

Details

    Description

      The following example seems to reproduce a bug with QTextLine/QTextLayout.

      The text line seems to exceed the number of characters set by setNumColumns().

      It seems to vary by font. It also varies from system to system how many fonts reproduce the problem.

      The lowest amount of fonts that reproduce this we have seen is 1.

      It seems to reproduce with the same fonts from system to system though.

      This output is from one machine running this version of fontconfig:

      fontconfig 2.5.0-2ubuntu3

      We can also reproduce this on Windows.

      bug "DejaVu Sans" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "DejaVu Serif" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Lohit Gujarati" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Lohit Hindi" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Lohit Punjabi" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Lohit Tamil" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Mallige" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Norasi" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "OpenSymbol" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "ori1Uni" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Sawasdee" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Serif" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"
      bug "Vemana2000" 113 > 112 "socket im buffer sowohl quit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi i"

      #include <QtGui>
      
      int main(int argc, char **argv)
      {
          QApplication app(argc, argv);
      
          // this string triggers the behaviour
          const QString str("jo das ganze user removal zeug basiert aktuell auf  deleteLater()... -> event loop... aber wenn der ircserver socket im buffer sowohl
      uit als auch join hat, dann scheduled das quit 'n delete later und das join wird quasi ignoriert");
      
          QFontDatabase db;
          foreach(const QString &family, db.families()) {
              QTextLayout layout(str);
              layout.setFont(QFont(family, 10));
      
              QTextOption option;
              option.setWrapMode(QTextOption::WrapAnywhere);
              layout.setTextOption(option);
      
              QTextLine line;
              layout.beginLayout();
      
              const int ints[] = { 109, 112, 500, -1 };
              for (int i=0; ints[i] != -1; ++i) {
                  line = layout.createLine();
                  line.setNumColumns(ints[i]);
                  const QString ln = str.mid(line.textStart(), line.textLength());
                  if (ln.simplified().size() > ints[i]) {
                      qDebug() << "bug" << family << ln.size() << ">" << ints[i] << ln;
                  }
              }
              layout.endLayout();
          }
      
          return 0;
      }
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            rve Anders Bakken
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes