summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfontdatabase_s60.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@nokia.com>2011-07-25 16:22:22 +0200
committerAlessandro Portale <alessandro.portale@nokia.com>2011-07-27 10:08:25 +0200
commitfa344b355d311fce7954e2fd1a22a87a88194783 (patch)
tree54a9cdfdad5c97f324fb33c1b9f47a855068e50b /src/gui/text/qfontdatabase_s60.cpp
parent9af3a9d59ace4c1ede928959910d7a8698389088 (diff)
Symbian^3 workaround: Avoid usage of linked fonts.
"Linked Fonts" are a new feature in Symbian^3, first used in SR11.1. This patch prevents Qt from using linked fonts in any way. Avkon based applications benefit from Linked Fonts because they can now transparently render multi-script text, e.g. Latin/Chinese/Japanese (Qt does that by its own and calls the feature 'font merging'). From Qt's poing of view, Linked Fonts are a severe regression in Symbian's API. 1 Font table Api for linked fonts is extremely slow 2 'cmap' tables do not seem to reflect the "linkage", causing garbled text or crashes. 3 Linked fonts appear with cryptic type face names, and are redundant since they are just compounds of the other, real fonts. This patch adds a detection of Linked Fonts using CLinkedTypefaceSpecification and prevents their inclusion into QFontDataBase. Furthermore, it detects if the Symbian System font is a Linked font and if needed tries to fall back to a classical Symbian system font, e.g. "Nokia Sans S60" or "Series 60 Sans". Fallback to "Pure" will need to be added, later on. Task-Number: QTBUG-20007 Co-authored-by: Miklos Vlasa Reviewed-by: mread <qt-info@nokia.com>
Diffstat (limited to 'src/gui/text/qfontdatabase_s60.cpp')
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 1eb4242005..ffecca735f 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)) {