Don't use the fallback list to decide if the CoreText font db was populated

In some situation (such as iOS currently) we may end up with an empty
fallback list, and we don't want to re-populate the font database
on every call to fallbacksForFamily().

We do not guard populateFontDatabase(), since it's called both initially
and every time the font database has been invalidated.

Change-Id: Ief1342c40f75e5d393e054e9a20bc94bc357d482
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
bb10
Tor Arne Vestbø 2013-02-11 13:49:42 +01:00 committed by The Qt Project
parent 23b11e792c
commit 183e04a439
1 changed files with 5 additions and 1 deletions

View File

@ -381,8 +381,12 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
Q_UNUSED(family);
Q_UNUSED(style);
Q_UNUSED(script);
if (fallbackLists.isEmpty())
static bool didPopulateFallbackList = false;
if (!didPopulateFallbackList) {
const_cast<QCoreTextFontDatabase*>(this)->populateFontDatabase();
didPopulateFallbackList = true;
}
return fallbackLists[styleHint];
}