summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase_qpa.cpp
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-09-22 14:23:29 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-23 10:48:37 +0200
commit8b4e40f5354ef81c40d8da35e0e79b2a87278e31 (patch)
tree4a6efda2e6a3de84668199752107ae72f795e778 /src/gui/text/qfontdatabase_qpa.cpp
parent9ee53afb32cc1bea6f60f4ca7a951330a979c04a (diff)
Support adding application fonts with QFontconfigDatabase
QFontDatabaseQPA should be able to reinitialize database and reregister all the fonts when an application font is added, because it will trigger db->invalidate(). Add cloneWithSize support to QFontEngineBox so that even no usable font is found in QFontDatabase, QRawFont::setPixelSize can still work (without making the result rawfont invalid). Register application fonts with QFontconfigDatabase, the code is adapted from QFontDatabaseX11. Reenable QRawFont tests for QPA, these usages are now supported in QPA. Fix QStaticText tests, raster in QPA does support transformations. Translate the text before ZAxix rotation so that it will be visible in canvas. Add back fixedPitch support to QPA, and fix QFontDatabase tests. Fix QGlyphRun tests, ignore non-existence glyphs in alphaMap locking. Fix QFontMetrics tests. Task-number: QTBUG-21415, QTBUG-20754, QTBUG-20977, QTBUG-20976, QTBUG-20760, QTBUG-20759 Change-Id: I24aea7d6ec6b2ac6342134d1f2591327c23a692b Reviewed-on: http://codereview.qt-project.org/5384 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui/text/qfontdatabase_qpa.cpp')
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 3a578e746f..fbee077ba7 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -53,16 +53,18 @@
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void qt_registerFont(const QString &familyName, const QString &foundryname, int weight,
- QFont::Style style, int stretch, bool antialiased, bool scalable, int pixelSize,
+ QFont::Style style, int stretch, bool antialiased,
+ bool scalable, int pixelSize, bool fixedPitch,
const QSupportedWritingSystems &writingSystems, void *handle)
{
QFontDatabasePrivate *d = privateDb();
- // qDebug() << "Adding font" << familyname << weight << italic << pixelSize << file << fileIndex << antialiased;
+ // qDebug() << "Adding font" << familyName << weight << style << pixelSize << antialiased;
QtFontStyle::Key styleKey;
styleKey.style = style;
styleKey.weight = weight;
styleKey.stretch = stretch;
QtFontFamily *f = d->family(familyName, true);
+ f->fixedPitch = fixedPitch;
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
if (writingSystems.supported(QFontDatabase::WritingSystem(i))) {
@@ -106,10 +108,12 @@ static QStringList fallbackFamilies(const QString &family, const QFont::Style &s
static void initializeDb()
{
static int initialized = false;
+ QFontDatabasePrivate *db = privateDb();
- if (!initialized) {
+ if (!initialized || db->reregisterAppFonts) {
//init by asking for the platformfontdb for the first time :)
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
+ db->reregisterAppFonts = false;
initialized = true;
}
}