diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-27 08:19:46 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-27 08:19:46 (GMT) |
commit | d380d36a84a2b5814e7b06d28a5cc68866e9fd2b (patch) | |
tree | 42c8e4e9b33d8361a75e1f354dd47f0dbd15bd2a | |
parent | 32763b898ad96cc0906aaf3406325134b849a284 (diff) | |
parent | fa344b355d311fce7954e2fd1a22a87a88194783 (diff) | |
download | Qt-d380d36a84a2b5814e7b06d28a5cc68866e9fd2b.zip Qt-d380d36a84a2b5814e7b06d28a5cc68866e9fd2b.tar.gz Qt-d380d36a84a2b5814e7b06d28a5cc68866e9fd2b.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public:
Symbian^3 workaround: Avoid usage of linked fonts.
-rw-r--r-- | src/gui/text/qfont_s60.cpp | 33 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_s60.cpp | 38 |
2 files changed, 62 insertions, 9 deletions
diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp index a7a2547..2218617 100644 --- a/src/gui/text/qfont_s60.cpp +++ b/src/gui/text/qfont_s60.cpp @@ -55,6 +55,24 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, { // Therefore, we are allowed to cache the list. x->append(qt_symbian_fontFamiliesOnFontServer()); }); + +extern bool qt_symbian_isLinkedFont(const TDesC &typefaceName); // qfontdatabase_s60.cpp + +static QString classicalSymbianSystemFont() +{ + static QString font; + if (font.isEmpty()) { + static const char* const classicSymbianSystemFonts[] = { "Nokia Sans S60", "Series 60 Sans" }; + for (int i = 0; i < sizeof classicSymbianSystemFonts / sizeof classicSymbianSystemFonts[0]; ++i) { + const QString classicFont = QLatin1String(classicSymbianSystemFonts[i]); + if (fontFamiliesOnFontServer()->contains(classicFont)) { + font = classicFont; + break; + } + } + } + return font; +} #endif // QT_NO_FREETYPE QString QFont::lastResortFont() const @@ -84,6 +102,10 @@ QString QFont::lastResortFamily() const S60->screenDevice()->ReleaseFont(font); lock.relock(); + + // We must not return a Symbian Linked Font. See QTBUG-20007 + if (qt_symbian_isLinkedFont(spec.iTypeface.iName) && !classicalSymbianSystemFont().isEmpty()) + family = classicalSymbianSystemFont(); } return family; #else // QT_NO_FREETYPE @@ -103,14 +125,9 @@ 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; - } - } + case QFont::SansSerif: + if (!classicalSymbianSystemFont().isEmpty()) + return classicalSymbianSystemFont(); // No break. Intentional fall through. default: return lastResortFamily(); diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 1eb4242..ffecca7 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -58,8 +58,41 @@ #endif // SYMBIAN_ENABLE_SPLIT_HEADERS #endif // QT_NO_FREETYPE +#ifndef SYMBIAN_VERSION_9_4 +#define SYMBIAN_LINKEDFONTS_SUPPORTED +#endif // !SYMBIAN_VERSION_9_4 + +#ifdef SYMBIAN_LINKEDFONTS_SUPPORTED +#include <linkedfonts.h> +#endif // SYMBIAN_LINKEDFONTS_SUPPORTED + QT_BEGIN_NAMESPACE +#ifdef SYMBIAN_LINKEDFONTS_SUPPORTED +static bool isLinkedFontL(const TDesC &aTypefaceName) +{ + CLinkedTypefaceSpecification *linkedspec = CLinkedTypefaceSpecification::NewLC(aTypefaceName); + CFbsTypefaceStore *tfs = CFbsTypefaceStore::NewL(NULL); + CleanupStack::PushL(tfs); + linkedspec->FetchLinkedTypefaceSpecificationL(*tfs); + CleanupStack::PopAndDestroy(tfs); + CleanupStack::PopAndDestroy(linkedspec); + return true; +} +#endif // SYMBIAN_LINKEDFONTS_SUPPORTED + +bool qt_symbian_isLinkedFont(const TDesC &typefaceName) // Also used in qfont_s60.cpp +{ + bool isLinkedFont = false; +#ifdef SYMBIAN_LINKEDFONTS_SUPPORTED + if (RFbsSession::Connect() == KErrNone) { + TRAP_IGNORE(isLinkedFont = isLinkedFontL(typefaceName)); + RFbsSession::Disconnect(); + } +#endif // SYMBIAN_LINKEDFONTS_SUPPORTED + return isLinkedFont; +} + QStringList qt_symbian_fontFamiliesOnFontServer() // Also used in qfont_s60.cpp { QStringList result; @@ -468,7 +501,10 @@ static bool registerScreenDeviceFont(int screenDeviceFontIndex, const QSymbianFontDatabaseExtrasImplementation *dbExtras) { TTypefaceSupport typefaceSupport; - S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex); + S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex); + + if (qt_symbian_isLinkedFont(typefaceSupport.iTypeface.iName)) + return false; QString familyName((const QChar*)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length()); if (qt_symbian_fontNameHasAppFontMarker(familyName)) { |