src/gui/text/qfontdatabase_s60.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 19 fcece45ef507
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     7 ** This file is part of the QtGui module of the Qt Toolkit.
     8 **
     8 **
   244         db->s60Store = new QFontDatabaseS60StoreImplementation;
   244         db->s60Store = new QFontDatabaseS60StoreImplementation;
   245 
   245 
   246     QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
   246     QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
   247     
   247     
   248     const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces();
   248     const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces();
   249     const QFontDatabaseS60StoreImplementation *store = dynamic_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
   249     const QFontDatabaseS60StoreImplementation *store =
   250     Q_ASSERT(store);
   250             static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
   251     bool fontAdded = false;
   251     bool fontAdded = false;
   252     for (int i = 0; i < numTypeFaces; i++) {
   252     for (int i = 0; i < numTypeFaces; i++) {
   253         TTypefaceSupport typefaceSupport;
   253         TTypefaceSupport typefaceSupport;
   254         QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i);
   254         QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i);
   255         CFont *font; // We have to get a font instance in order to know all the details
   255         CFont *font; // We have to get a font instance in order to know all the details
   256         TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11);
   256         TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11);
   257         if (QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
   257         if (QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
   258             continue;
   258             continue;
   259         if (font->TypeUid() == KCFbsFontUid) {
   259         if (font->TypeUid() == KCFbsFontUid) {
   260             TOpenFontFaceAttrib faceAttrib;
   260             TOpenFontFaceAttrib faceAttrib;
   261             const CFbsFont *cfbsFont = dynamic_cast<const CFbsFont *>(font);
   261             const CFbsFont *cfbsFont = static_cast<const CFbsFont *>(font);
   262             Q_ASSERT(cfbsFont);
       
   263             cfbsFont->GetFaceAttrib(faceAttrib);
   262             cfbsFont->GetFaceAttrib(faceAttrib);
   264 
   263 
   265             QtFontStyle::Key styleKey;
   264             QtFontStyle::Key styleKey;
   266             styleKey.style = faceAttrib.IsItalic()?QFont::StyleItalic:QFont::StyleNormal;
   265             styleKey.style = faceAttrib.IsItalic()?QFont::StyleItalic:QFont::StyleNormal;
   267             styleKey.weight = faceAttrib.IsBold()?QFont::Bold:QFont::Normal;
   266             styleKey.weight = faceAttrib.IsBold()?QFont::Bold:QFont::Normal;
   388 
   387 
   389         const QString fontFamily = desc.family->name;
   388         const QString fontFamily = desc.family->name;
   390         QFontDef request = req;
   389         QFontDef request = req;
   391         request.family = fontFamily;
   390         request.family = fontFamily;
   392 #if defined(QT_NO_FREETYPE)
   391 #if defined(QT_NO_FREETYPE)
   393         const QFontDatabaseS60StoreImplementation *store = dynamic_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
   392         const QFontDatabaseS60StoreImplementation *store =
   394         Q_ASSERT(store);
   393                 static_cast<const QFontDatabaseS60StoreImplementation*>(db->s60Store);
   395         const QFontEngineS60Extensions *extension = store->extension(fontFamily);
   394         const QFontEngineS60Extensions *extension = store->extension(fontFamily);
   396         fe = new QFontEngineS60(request, extension);
   395         fe = new QFontEngineS60(request, extension);
   397 #else
   396 #else
   398         QFontEngine::FaceId faceId;
   397         QFontEngine::FaceId faceId;
   399         const QtFontFamily * const reqQtFontFamily = db->family(fontFamily);
   398         const QtFontFamily * const reqQtFontFamily = db->family(fontFamily);