Embed fonts[Solved]
-
Hi Guys,
how can i embed fonts in qt from a folder as a resource?
Gaurav
-
Hi,
FontLoader ia a QML feature.
You can try int QFontDatabase::addApplicationFont ( const QString & fileName ), but I'm not sure, whether it can load from a resource.
Otherwise you can load the resource by hand and call int QFontDatabase::addApplicationFontFromData ( const QByteArray & fontData ) [static].
Here you can find mor information:http://doc.qt.nokia.com/4.7/qfontdatabase.html#addApplicationFont
-
The fonts example demonstrates use:
http://doc.trolltech.com/4.7/declarative-text-fonts-fonts-qml.htmlIf you want to use fonts in a resource, they work identically to images and other things inside a Qt resource file. Just create a new qrc file in Qt Creator (or whatever), add the fonts, then reference it using the qrc:// syntax rather then a raw file:// path one. There's a little documentation on the use of qrc urls here: http://doc.trolltech.com/latest/qdeclarativenetwork.html but I don't recall any specific examples.
-
Thanks guys for the reply.
-
One more quick question is there any way i can include fonts in a folder and give the path in css?