summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont_s60.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qfont_s60.cpp')
-rw-r--r--src/gui/text/qfont_s60.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp
index ccd17a2..2d547a9 100644
--- a/src/gui/text/qfont_s60.cpp
+++ b/src/gui/text/qfont_s60.cpp
@@ -40,15 +40,26 @@
****************************************************************************/
#include "qfont.h"
+#include "qfont_p.h"
#include <private/qt_s60_p.h>
#include <private/qpixmap_s60_p.h>
#include "qmutex.h"
QT_BEGIN_NAMESPACE
-#if 1
#ifdef QT_NO_FREETYPE
Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex);
+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();
+});
#endif // QT_NO_FREETYPE
QString QFont::lastResortFamily() const
@@ -70,7 +81,7 @@ QString QFont::lastResortFamily() const
lock.relock();
}
return family;
-#else
+#else // QT_NO_FREETYPE
// For the FreeType case we just hard code the face name, since otherwise on
// East Asian systems we may get a name for a stroke based (non-ttf) font.
@@ -82,15 +93,24 @@ QString QFont::lastResortFamily() const
return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":"Series 60 Sans");
#endif // QT_NO_FREETYPE
}
-#else // 0
-QString QFont::lastResortFamily() const
-{
- return QLatin1String("Series 60 Sans");
-}
-#endif // 0
QString QFont::defaultFamily() const
{
+#ifdef QT_NO_FREETYPE
+ switch(d->request.styleHint) {
+ case QFont::SansSerif: {
+ static const char* const preferredSansSerif[] = {"Nokia Sans S60", "Series 60 Sans"};
+ for (int i = 0; i < sizeof preferredSansSerif / sizeof preferredSansSerif[0]; ++i) {
+ const QString sansSerif = QLatin1String(preferredSansSerif[i]);
+ if (fontFamiliesOnFontServer()->contains(sansSerif))
+ return sansSerif;
+ }
+ }
+ // No break. Intentional fall through.
+ default:
+ return lastResortFamily();
+ }
+#endif // QT_NO_FREETYPE
return lastResortFamily();
}