summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-03-07 01:46:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-11 03:39:34 +0100
commit800232e1d3ebfbac28d07014a3c646ea00fcf6ad (patch)
treede84641436afca7605d57772e3e629e2d264a404
parentc3b2425791ec1e17a8b1e2f5b35b8e79176fc9c4 (diff)
Fix custom font substitution list support
During the QPA refactoring, the custom font substitution list support was lost by ignoring the font request's fallbackFamilies member when the multi font engine gets created/initialized. If fallbackFamilies is not empty, it should be prepended to the font database default fallback families list. Also respect the custom fallback families list in the cache key to avoid picking a multi font engine with wrong fallbacks list. Task-number: QTBUG-36628 Change-Id: Ie2b84b3a397bee4816f421cddf76a5375829f13a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--src/gui/text/qfont_p.h22
-rw-r--r--src/gui/text/qfontdatabase.cpp6
2 files changed, 20 insertions, 8 deletions
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 6165554388..b78d6692b4 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -228,22 +228,32 @@ public:
void clear();
struct Key {
- Key() : script(0), screen(0) { }
- Key(const QFontDef &d, int c, int s = 0)
- : def(d), script(c), screen(s) { }
+ Key() : script(0), multi(0), screen(0) { }
+ Key(const QFontDef &d, uchar c, bool m = 0, uchar s = 0)
+ : def(d), script(c), multi(m), screen(s) { }
QFontDef def;
- int script;
- int screen;
+ uchar script;
+ uchar multi: 1;
+ uchar screen: 7;
inline bool operator<(const Key &other) const
{
if (script != other.script) return script < other.script;
if (screen != other.screen) return screen < other.screen;
+ if (multi != other.multi) return multi < other.multi;
+ if (multi && def.fallBackFamilies.size() != other.def.fallBackFamilies.size())
+ return def.fallBackFamilies.size() < other.def.fallBackFamilies.size();
return def < other.def;
}
inline bool operator==(const Key &other) const
- { return def == other.def && script == other.script && screen == other.screen; }
+ {
+ return script == other.script
+ && screen == other.screen
+ && multi == other.multi
+ && (!multi || def.fallBackFamilies.size() == other.def.fallBackFamilies.size())
+ && def == other.def;
+ }
};
// QFontEngineData cache
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 1dfccca57c..3c2cf4fdcf 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -824,9 +824,11 @@ QFontEngine *loadEngine(int script, const QFontDef &request,
family->askedForFallback = true;
}
- QStringList fallbacks = privateDb()->fallbackFamilies;
+ QStringList fallbacks = request.fallBackFamilies;
if (family && !family->fallbackFamilies.isEmpty())
- fallbacks = family->fallbackFamilies;
+ fallbacks += family->fallbackFamilies;
+ else
+ fallbacks += privateDb()->fallbackFamilies;
QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));