From c207a85d9d8e541a30f7dd7f0721f204757650e1 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 8 Sep 2010 21:03:05 +0200 Subject: Moved font list getter to qfontdatabase_s60.cpp. Reusable. Preparations for Application font support on Symbian Task-Number: QTBUG-6611 --- src/gui/text/qfont_s60.cpp | 13 ++++--------- src/gui/text/qfontdatabase_s60.cpp | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index 2d547a9..d39f30a 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -49,16 +49,11 @@ QT_BEGIN_NAMESPACE #ifdef QT_NO_FREETYPE Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex); +extern QStringList qt_symbian_fontFamiliesOnFontServer(); // qfontdatabase_s60.cpp Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, { - QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - const int numTypeFaces = S60->screenDevice()->NumTypefaces(); - for (int i = 0; i < numTypeFaces; i++) { - TTypefaceSupport typefaceSupport; - S60->screenDevice()->TypefaceSupport(typefaceSupport, i); - const QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length()); - x->append(familyName); - } - lock.relock(); + // We are only interested in the initial font families. No Application fonts. + // Therefore, we are allowed to cache the list. + x->append(qt_symbian_fontFamiliesOnFontServer()); }); #endif // QT_NO_FREETYPE diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index f9d8d31..b73555f 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -58,6 +58,21 @@ QT_BEGIN_NAMESPACE +QStringList qt_symbian_fontFamiliesOnFontServer() // Also used in qfont_s60.cpp +{ + QStringList result; + QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); + const int numTypeFaces = S60->screenDevice()->NumTypefaces(); + for (int i = 0; i < numTypeFaces; i++) { + TTypefaceSupport typefaceSupport; + S60->screenDevice()->TypefaceSupport(typefaceSupport, i); + const QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length()); + result.append(familyName); + } + lock.relock(); + return result; +} + QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameFilters, QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort, bool uniqueFileNames = true) -- cgit v0.12