diff options
Diffstat (limited to 'src/plugins/platforms')
3 files changed, 16 insertions, 9 deletions
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) |