diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 376ad43..8df2d78 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -98,7 +98,7 @@ public: QSymbianFontDatabaseExtrasImplementation(); ~QSymbianFontDatabaseExtrasImplementation(); - const QSymbianTypeFaceExtras *extras(const QString &typeface) const; + const QSymbianTypeFaceExtras *extras(const QString &typeface, bool bold, bool italic) const; private: RHeap* m_heap; @@ -156,12 +156,18 @@ COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont) } #endif // FNTSTORE_H_INLINES_SUPPORT_FMM -const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &typeface) const +const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &typeface, + bool bold, bool italic) const { - if (!m_extras.contains(typeface)) { + const QString key = typeface + QString::number(int(bold)) + QString::number(int(italic)); + if (!m_extras.contains(key)) { CFont* font = NULL; TFontSpec spec(qt_QString2TPtrC(typeface), 1); spec.iHeight = 1; + if (bold) + spec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); + if (italic) + spec.iFontStyle.SetPosture(EPostureItalic); const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, spec); Q_ASSERT(err == KErrNone && font); const CBitmapFont *bitmapFont = static_cast(font); @@ -171,9 +177,9 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c #else OpenFontFromBitmapFont(bitmapFont); #endif // FNTSTORE_H_INLINES_SUPPORT_FMM - m_extras.insert(typeface, new QSymbianTypeFaceExtras(font, openFont)); + m_extras.insert(key, new QSymbianTypeFaceExtras(font, openFont)); } - return m_extras.value(typeface); + return m_extras.value(key); } #else class QFontEngineFTS60 : public QFontEngineFT @@ -273,7 +279,8 @@ static void initializeDb() style->smoothScalable = typefaceSupport.iIsScalable; style->pixelSize(0, true); - const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(familyName); + const QSymbianTypeFaceExtras *typeFaceExtras = + dbExtras->extras(familyName, faceAttrib.IsBold(), faceAttrib.IsBold()); const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2')); const unsigned char* data = reinterpret_cast(os2Table.constData()); const unsigned char* ulUnicodeRange = data + 42; @@ -396,7 +403,8 @@ QFontEngine *QFontDatabase::findFont(int script, const QFontPrivate *, const QFo #if defined(QT_NO_FREETYPE) const QSymbianFontDatabaseExtrasImplementation *dbExtras = static_cast(db->symbianExtras); - const QSymbianTypeFaceExtras *typeFaceExtras = dbExtras->extras(fontFamily); + const QSymbianTypeFaceExtras *typeFaceExtras = + dbExtras->extras(fontFamily, request.weight >= QFont::DemiBold, request.style != QFont::StyleNormal); fe = new QFontEngineS60(request, typeFaceExtras); #else QFontEngine::FaceId faceId;