summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPierre Rossi <pierre.rossi@nokia.com>2011-07-15 12:03:15 (GMT)
committerPierre Rossi <pierre.rossi@nokia.com>2011-07-21 13:13:40 (GMT)
commit89fb49ab13949d5ed1fb8bf0d306d9f1b2c38a71 (patch)
tree3522f2ae98fef4bcce979ff92ca52259f208a7ac /src
parentb683aaa27430ced087b4230e031f56c3100f8068 (diff)
downloadQt-89fb49ab13949d5ed1fb8bf0d306d9f1b2c38a71.zip
Qt-89fb49ab13949d5ed1fb8bf0d306d9f1b2c38a71.tar.gz
Qt-89fb49ab13949d5ed1fb8bf0d306d9f1b2c38a71.tar.bz2
Add a way to check if we have a matching family in the database.
This is needed in order to get proper font fallback, and incidentally webfonts, working in QtWebKit. See: https://bugs.webkit.org/show_bug.cgi?id=55036 Internal for now, maybe it could be made public for a future release. Task-number: QTBUG-15575 Change-Id: I5c454689125cd9d5fda26ff2149208ed1beec24d Reviewed-on: http://codereview.qt.nokia.com/1829 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontdatabase.cpp10
-rw-r--r--src/gui/text/qfontdatabase.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 3762f39..4e667a4 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2239,6 +2239,16 @@ int QFontDatabase::weight(const QString &family,
}
+/*! \internal */
+bool QFontDatabase::hasFamily(const QString &family) const
+{
+ QString parsedFamily, foundry;
+ parseFontName(family, foundry, parsedFamily);
+ const QString familyAlias = resolveFontFamilyAlias(parsedFamily);
+ return families().contains(familyAlias, Qt::CaseInsensitive);
+}
+
+
/*!
Returns the names the \a writingSystem (e.g. for displaying to the
user in a dialog).
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index d3463a0..b1f370e 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -138,6 +138,8 @@ public:
bool bold(const QString &family, const QString &style) const;
int weight(const QString &family, const QString &style) const;
+ bool hasFamily(const QString &family) const;
+
static QString writingSystemName(WritingSystem writingSystem);
static QString writingSystemSample(WritingSystem writingSystem);