[Interest] Fallback fonts embedded for a QtQuick application?

Preet prismatic.project at gmail.com
Sun Apr 20 19:11:30 CEST 2014


> I don't think you can force Qt to fallback only to QRC fonts - for starters
> how would Qt know which paths in your resources have the fonts?

By specifying them somehow -- I wonder if the QFontDatabase
addApplicationFont method you mentioned allows me to pass in QRC urls.
Then I could maybe get away with:

QFontDatabase::removeAllFonts
QFontDatabase::addApplicatonFont(:/font1) // latin
QFontDatabase::addApplicatonFont(:/font2) // itl font 1
QFontDatabase::addApplicatonFont(:/font3) // itl font 2
QFontDatabase::addApplicatonFont(:/font4) // itl font 3

etc.

I'm not clear on if Qt will make an attempt to find the right font if
the first attempt fails though... could anyone elaborate?

> But, you could also store a list of the fonts, and their character ranges.
> When you load the texts, check each character is in one of the ranges, then
> load the font using QFontDatabase.addApplicationFont.

Having to preprocess everything I send out to QML wouldn't be fun, but
its a viable solution. Thanks for the input.


Preet



More information about the Interest mailing list