If a unicode character with code values above 65535, it will be stored using surrogate pairs, I store it in an QString object, and draw it with QPainter, but nothing will appear, is this a bug? or QPainter’s drawText just doesn’t support characters above 65535?
I have set a correct font, the same font in other text editors / word processers can display this character.
Here is a unicode character for test: http://www.unicode.org/cgi-bin/GetUn...odepoint=22489
QChar data[2]={0xd849,0xdc89};
QString str(data, 2);
QRect rect(0, 0, width(), height());
m_backingStore->beginPaint(rect);
QPaintDevice *device = m_backingStore->paintDevice();
QPainter painter(device);
QFont songTi(tr("simsun"), 12, 12);
painter.setFont(songTi);
painter.fillRect(0, 0, width(), height(), Qt::green);
painter.drawText(QRectF(100, 100, width(), height()), str);
m_backingStore->endPaint();
m_backingStore->flush(rect);
Bookmarks