src/gui/text/qfontdatabase_s60.cpp
changeset 25 e24348a560a6
parent 23 89e065397ea6
child 29 b72c6db6890b
--- a/src/gui/text/qfontdatabase_s60.cpp	Thu May 27 13:40:48 2010 +0300
+++ b/src/gui/text/qfontdatabase_s60.cpp	Fri Jun 11 14:24:45 2010 +0300
@@ -92,23 +92,23 @@
 }
 
 #if defined(QT_NO_FREETYPE)
-class QFontDatabaseS60StoreImplementation : public QFontDatabaseS60Store
+class QSymbianFontDatabaseExtrasImplementation : public QSymbianFontDatabaseExtras
 {
 public:
-    QFontDatabaseS60StoreImplementation();
-    ~QFontDatabaseS60StoreImplementation();
+    QSymbianFontDatabaseExtrasImplementation();
+    ~QSymbianFontDatabaseExtrasImplementation();
 
-    const QFontEngineS60Extensions *extension(const QString &typeface, bool bold, bool italic) const;
+    const QSymbianTypeFaceExtras *extras(const QString &typeface, bool bold, bool italic) const;
 
 private:
     RHeap* m_heap;
     CFontStore *m_store;
     COpenFontRasterizer *m_rasterizer;
-    mutable QList<const QFontEngineS60Extensions *> m_extensions;
-    mutable QHash<QString, const QFontEngineS60Extensions *> m_extensionsHash;
+    mutable QList<const QSymbianTypeFaceExtras *> m_extras;
+    mutable QHash<QString, const QSymbianTypeFaceExtras *> m_extrasHash;
 };
 
-QFontDatabaseS60StoreImplementation::QFontDatabaseS60StoreImplementation()
+QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementation()
 {
     QStringList filters;
     filters.append(QLatin1String("*.ttf"));
@@ -131,10 +131,11 @@
         QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr));
     }
 }
-QFontDatabaseS60StoreImplementation::~QFontDatabaseS60StoreImplementation()
+
+QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation()
 {
-    typedef QList<const QFontEngineS60Extensions *>::iterator iterator;
-    for (iterator p = m_extensions.begin(); p != m_extensions.end(); ++p) {
+    typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator;
+    for (iterator p = m_extras.begin(); p != m_extras.end(); ++p) {
         m_store->ReleaseFont((*p)->fontOwner());
         delete *p;
     }
@@ -160,11 +161,11 @@
 }
 #endif // FNTSTORE_H_INLINES_SUPPORT_FMM
 
-const QFontEngineS60Extensions *QFontDatabaseS60StoreImplementation::extension(const QString &typeface, 
+const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &typeface,
                                                                                bool bold, bool italic) const
 {
     const QString searchKey = typeface + QString::number(int(bold)) + QString::number(int(italic));
-    if (!m_extensionsHash.contains(searchKey)) {
+    if (!m_extrasHash.contains(searchKey)) {
         CFont* font = NULL;
         TFontSpec searchSpec(qt_QString2TPtrC(typeface), 1);
         if (bold)
@@ -183,17 +184,17 @@
         const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib();
         const QString foundKey =
                 QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length());
-        if (!m_extensionsHash.contains(foundKey)) {
-            QFontEngineS60Extensions *extras = new QFontEngineS60Extensions(font, openFont);
-            m_extensions.append(extras);
-            m_extensionsHash.insert(searchKey, extras);
-            m_extensionsHash.insert(foundKey, extras);
+        if (!m_extrasHash.contains(foundKey)) {
+            QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont);
+            m_extras.append(extras);
+            m_extrasHash.insert(searchKey, extras);
+            m_extrasHash.insert(foundKey, extras);
         } else {
             m_store->ReleaseFont(font);
-            m_extensionsHash.insert(searchKey, m_extensionsHash.value(foundKey));
+            m_extrasHash.insert(searchKey, m_extrasHash.value(foundKey));
         }
     }
-    return m_extensionsHash.value(searchKey);
+    return m_extrasHash.value(searchKey);
 }
 #else
 class QFontEngineFTS60 : public QFontEngineFT
@@ -260,14 +261,14 @@
         return;
 
 #if defined(QT_NO_FREETYPE)
-    if (!db->s60Store)
-        db->s60Store = new QFontDatabaseS60StoreImplementation;
+    if (!db->symbianExtras)
+        db->symbianExtras = new QSymbianFontDatabaseExtrasImplementation;
 
     QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
     
     const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces();
-    const QFontDatabaseS60StoreImplementation *store =
-            static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
+    const QSymbianFontDatabaseExtrasImplementation *dbExtras =
+            static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
     bool fontAdded = false;
     for (int i = 0; i < numTypeFaces; i++) {
         TTypefaceSupport typefaceSupport;
@@ -293,8 +294,9 @@
             style->smoothScalable = typefaceSupport.iIsScalable;
             style->pixelSize(0, true);
 
-            const QFontEngineS60Extensions *extension = store->extension(familyName, faceAttrib.IsBold(), faceAttrib.IsItalic());
-            const QByteArray os2Table = extension->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
+            const QSymbianTypeFaceExtras *typeFaceExtras =
+                    dbExtras->extras(familyName, faceAttrib.IsBold(), faceAttrib.IsItalic());
+            const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
             const unsigned char* data = reinterpret_cast<const unsigned char*>(os2Table.constData());
             const unsigned char* ulUnicodeRange = data + 42;
             quint32 unicodeRange[4] = {
@@ -414,10 +416,11 @@
         QFontDef request = req;
         request.family = fontFamily;
 #if defined(QT_NO_FREETYPE)
-        const QFontDatabaseS60StoreImplementation *store =
-                static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
-        const QFontEngineS60Extensions *extension = store->extension(fontFamily, request.weight > QFont::Normal, request.style != QFont::StyleNormal );
-        fe = new QFontEngineS60(request, extension);
+        const QSymbianFontDatabaseExtrasImplementation *dbExtras =
+                static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
+        const QSymbianTypeFaceExtras *typeFaceExtras =
+                dbExtras->extras(fontFamily, request.weight > QFont::Normal, request.style != QFont::StyleNormal);
+        fe = new QFontEngineS60(request, typeFaceExtras);
 #else
         QFontEngine::FaceId faceId;
         const QtFontFamily * const reqQtFontFamily = db->family(fontFamily);