[Qt-interest] Does Qt support Unicode 5.1?

Shaun Cummins cumminss at gmail.com
Thu Mar 5 19:27:51 CET 2009


I tried using some new characters introduced in Unicode 5.1 last night but
could not get the characters to print. My code was similar to the following:

QFontDabase fontData;
int fontID = fontData.addApplicationFont(QString(":/MahjongFont.otf"));
// added the font to a resource file in the application
if (fontID != -1)
{
  QStringList fontNames = fontData.applicationFontFamilies(fontID); //
just returned one name as expected
  if (!fontNames.isEmpty())
  {
	QString& fontName = fontNames.first();
	QFont mahjongFont = fontData.font(fontName,QString(),24);
	ui->testLine->setFont(mahjongFont); // testLine is a QLineEdit on this form
	QChar testTiles = { 0x1f000, 0x1f001 };
	QString testStr(testTiles,2);
	ui->testLine->setText(testStr);
  }
}

The above compiles and doesn't cause any runtime error. But the text
displayed is just empty boxes. The font I used was downloaded from
http://users.teilar.gr/~g1951d/download.html<http://www.qtforum.org/index.php?page=ExternalLink&url=http%3A%2F%2Fusers.teilar.gr%2F%7Eg1951d%2Fdownload.html>(downloaded
the Unicode.otf file and renamed it to MahjongFont.otf)

I tried using other characters and all of the ones in Unicode 5.0 worked
fine and seemed to use the font I had downloaded (based on comparing the
displayed text with the pdf that is also available at that download page). I
also noticed that the QChar class has an enumeration for when a character
was introduced and only went up to Unicode 5.0.

I was using the release version of Qt 4.5.0 on Windows Vista (Home Premium).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090305/5a7ecbbb/attachment.html 


More information about the Qt-interest-old mailing list