PDA

View Full Version : QFontDatabase::addApplicationFont doesn't work for all fonts



chritz
31st July 2011, 16:16
Hello,

I'm having problems using chinese .ttf font (on Symbian Device using Qt4.7.3)
When I load a "standard" font like Arial, it works. Loading a Chinese Font doesn't work.


MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
QFileDialog dialog(this);
dialog.setFileMode(QFileDialog::ExistingFile);
QString fileName;
fileName = dialog.getOpenFileName(this);
qDebug()<<QFontDatabase::addApplicationFont(fileName);
//qDebug displays 0 for Arial.ttf, but -1 for chinese.ttf (not the real font Name)
bool ok;
QApplication::setFont(QFontDialog::getFont(&ok,this));
//**see below
ui->setupUi(this);
}

**As a consequence the font Dialog has Arial in its font list and returns true when selecting it, but not the chinese one.

-The fonts are located in the same directory.
-I got both fonts from the Windows Font Directory

I just found similar threads about addApplicationFont not working at all. But as it works for some fonts I don't know what I did wrong.

Thanks,
Chris

chritz
5th August 2011, 17:56
No ideas?
Maybe I should repost it to the Embedded/Mobile Forum?

mvuori
5th August 2011, 18:30
I would post it on Nokia Developer site and define the actual font (I understand that it is one particular font, not any Chinese font). After all, fonts have bugs too.

chritz
5th August 2011, 23:19
Well I tried different chinese fonts, two or three. Same error with all of them.