Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
4.5.2
-
None
Description
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();
}