summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-06-02 14:09:58 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-06-02 14:13:11 (GMT)
commitad46e77420449ede2cb6c1ea2a810a2614520db9 (patch)
tree87842b98bd017d46ad6a893be8646271bb18bbcd
parentd7700105933b3c4071f8df524915dbaa2092d82b (diff)
downloadQt-ad46e77420449ede2cb6c1ea2a810a2614520db9.zip
Qt-ad46e77420449ede2cb6c1ea2a810a2614520db9.tar.gz
Qt-ad46e77420449ede2cb6c1ea2a810a2614520db9.tar.bz2
BT: Remove duplicate code and fix font parsing.
QFont has a feature that you can pass a comma-separated list and it will walk through the list and match the font that it hits first. There's a nice static function that X11 and Windows uses, but the Mac was using an older copied version of it. This old version didn't handle quoting which is what happens in the style sheet. So, using the same code makes everything work well. As a bonus, Creator looks correct again. Reviewed-by: Simon Hausmann
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qfontdatabase_mac.cpp9
2 files changed, 2 insertions, 9 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index c3fc9f5..5fb294f 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -827,6 +827,7 @@ static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key)
d->engineData->ref.ref();
}
}
+#endif
static QStringList familyList(const QFontDef &req)
{
@@ -855,7 +856,6 @@ static QStringList familyList(const QFontDef &req)
return family_list;
}
-#endif
Q_GLOBAL_STATIC(QFontDatabasePrivate, privateDb)
Q_GLOBAL_STATIC_WITH_ARGS(QMutex, fontDatabaseMutex, (QMutex::Recursive))
diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp
index 80ddbd5..26d8687 100644
--- a/src/gui/text/qfontdatabase_mac.cpp
+++ b/src/gui/text/qfontdatabase_mac.cpp
@@ -281,14 +281,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
}
//find the font
- QStringList family_list = req.family.split(QLatin1Char(','));
- // append the substitute list for each family in family_list
- {
- QStringList subs_list;
- for(QStringList::ConstIterator it = family_list.constBegin(); it != family_list.constEnd(); ++it)
- subs_list += QFont::substitutes(*it);
- family_list += subs_list;
- }
+ QStringList family_list = familyList(req);
const char *stylehint = styleHint(req);
if (stylehint)