summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-09-30 12:23:54 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-09-30 12:23:54 (GMT)
commit1200bf9f82860d2f391a4b68ce25c606eb9a0831 (patch)
tree74b0e02d07b2bc0922a40dbe3120db29184072a3
parenta5cf78de2c7542ee64756f2bb894b56933e6d184 (diff)
parentd9f42e554c1da7aafad59881e1d143ff8672b833 (diff)
downloadQt-1200bf9f82860d2f391a4b68ce25c606eb9a0831.zip
Qt-1200bf9f82860d2f391a4b68ce25c606eb9a0831.tar.gz
Qt-1200bf9f82860d2f391a4b68ce25c606eb9a0831.tar.bz2
Merge remote branch 'lighthouse/4.7' into lighthouse-master
-rw-r--r--src/gui/text/qfontdatabase_qpa.cpp3
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp7
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.h2
-rw-r--r--src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp10
-rw-r--r--src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h4
-rw-r--r--src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp11
6 files changed, 25 insertions, 12 deletions
diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp
index 53594aa..19ce1be 100644
--- a/src/gui/text/qfontdatabase_qpa.cpp
+++ b/src/gui/text/qfontdatabase_qpa.cpp
@@ -199,7 +199,8 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
{
QFontDatabasePrivate *db = privateDb();
- QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
+ fnt->families = QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
+
db->reregisterAppFonts = true;
}
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 7bb1f9a..26f4faa 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -165,12 +165,17 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString family, cons
return QStringList();
}
-void QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
+/*!
+ Adds an application font. Returns a list of family names, or an empty list if the font could
+ not be added
+*/
+QStringList QPlatformFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
Q_UNUSED(fontData);
Q_UNUSED(fileName);
qWarning("This plugin does not support application fonts");
+ return QStringList();
}
void QPlatformFontDatabase::releaseHandle(void *handle)
diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h
index a34033f..adaa4cb 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.h
+++ b/src/gui/text/qplatformfontdatabase_qpa.h
@@ -46,7 +46,7 @@ public:
virtual void populateFontDatabase();
virtual QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
virtual QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const;
- virtual void addApplicationFont(const QByteArray &fontData, const QString &fileName);
+ virtual QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
virtual void releaseHandle(void *handle);
virtual QString fontDir() const;
diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp
index 5b8ca63..5b6f69a 100644
--- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp
+++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.cpp
@@ -204,9 +204,9 @@ QStringList QBasicUnixFontDatabase::fallbacksForFamily(const QString family, con
return QStringList();
}
-void QBasicUnixFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
+QStringList QBasicUnixFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
- addTTFile(fontData,fileName.toLocal8Bit());
+ return addTTFile(fontData,fileName.toLocal8Bit());
}
void QBasicUnixFontDatabase::releaseHandle(void *handle)
@@ -215,13 +215,14 @@ void QBasicUnixFontDatabase::releaseHandle(void *handle)
delete file;
}
-void QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file)
+QStringList QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QByteArray &file)
{
extern FT_Library qt_getFreetype();
FT_Library library = qt_getFreetype();
int index = 0;
int numFaces = 0;
+ QStringList families;
do {
FT_Face face;
FT_Error error;
@@ -275,7 +276,10 @@ void QBasicUnixFontDatabase::addTTFile(const QByteArray &fontData, const QByteAr
registerFont(family,"",weight,style,100,true,true,0,writingSystems,fontFile);
+ families.append(family);
+
FT_Done_Face(face);
++index;
} while (index < numFaces);
+ return families;
}
diff --git a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h
index 401a4aa..95015df 100644
--- a/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h
+++ b/src/plugins/platforms/fontdatabases/basicunix/qbasicunixfontdatabase.h
@@ -17,10 +17,10 @@ public:
void populateFontDatabase();
QFontEngine *fontEngine(const QFontDef &fontDef, QUnicodeTables::Script script, void *handle);
QStringList fallbacksForFamily(const QString family, const QFont::Style &style, const QUnicodeTables::Script &script) const;
- void addApplicationFont(const QByteArray &fontData, const QString &fileName);
+ QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName);
void releaseHandle(void *handle);
- static void addTTFile(const QByteArray &fontData, const QByteArray &file);
+ static QStringList addTTFile(const QByteArray &fontData, const QByteArray &file);
};
#endif // QBASICUNIXFONTDATABASE_H
diff --git a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
index 562cb2d..85515ed 100644
--- a/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
+++ b/src/plugins/platforms/fontdatabases/fontconfig/qfontconfigdatabase.cpp
@@ -392,10 +392,13 @@ void QFontconfigDatabase::populateFontDatabase()
++f;
}
- const FcDefaultFont *s = defaults;
- QFont font("Sans Serif");
- font.setPointSize(9);
- QApplication::setFont(font);
+ //Lighthouse has very lazy population of the font db. We want it to be initialized when
+ //QApplication is constructed, so that the population procedure can do something like this to
+ //set the default font
+// const FcDefaultFont *s = defaults;
+// QFont font("Sans Serif");
+// font.setPointSize(9);
+// QApplication::setFont(font);
}
QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QUnicodeTables::Script script, void *usrPtr)