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

Font width calculated wrong for certain characters of Wen Quan Yi

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P2: Important P2: Important
    • 4.6.0
    • 4.5.2
    • GUI: Font handling
    • None

      The wrong character width is calculated when using unicode characters 0x3360 and 0x336f when using the Wen Quan Yi fonts. This was tested on QWS. You have to download Wen Quan Yi fonts with 4.5.0 or later because they are no longer distributed with Qt due to licencing concerns.

      The following example shows how the character is rendered in QLineEdit widget, as you can see the cursor is placed in the middle of the character 0x3360. (please note although it appears like two glyphs it's really just one glyph here)

      #include <QApplication>
      #include <QLineEdit>
      #include <QFont>
      #include <QDebug>

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

      QFont font("Wen Quan Yi", 30);

      qDebug() << font;
      lineEdit.setFont(font);

      const QChar testcase[] =

      {0x3360, 0x336f}

      ;
      int size = sizeof(testcase) / sizeof(QChar);

      QString str = QString::fromRawData(testcase, size);

      lineEdit.setText(str);

      lineEdit.show();
      return a.exec();
      }

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

            esabraha Eskil Abrahamsen Blomfeldt
            janichol Andy Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes