PDA

View Full Version : addapplicationfont always returns -1



nick85
17th July 2013, 11:08
Hi,

I have a strange problem with loading of embedded fonts:
actally i have 2 applications:
1) GUI application with qt-4.7.2
2) QML application with qt-4.8.4

In both applications i try to load embedded font "Calculator" in this way:

Added "fonts" directory
Added "Calculator.ttf" font to directory
Added resources "fonts.qrc" inside "fonts" directory with prefix "/fonts"
Added file "Calculator.ttf" to fonts.qrc and added alias "Calculator".
In application main added follow lines:
int id = QFontDatabase::addApplicationFont( ":/fonts/Calculator" );
qDebug() << "id value=" << id;


in GUI application (#1) I have "id value= 0"
in QML application (#2) I have "id value= -1"

What's can be wrong in QML application?

ps. I've also try to add font without using resources but does not work too.

Added after 47 minutes:

Update: seems to be a problem of (my) Qt 4.8.4 installation because I've tried to use qt-4.7.2 in QML project and fonts is added correctly.