From 2409e4532b5742530c70431ad2967c43ef291839 Mon Sep 17 00:00:00 2001 From: mread Date: Thu, 10 Sep 2009 16:07:56 +0100 Subject: S60 font db more tolerant of failure This now loads the fonts it can and asserts that at least one is loaded, rather than requiring all fonts to load. Reviewed-by: Alessandro Portale --- src/gui/text/qfontdatabase_s60.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index dd0fcb4..e1a2c47 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -221,12 +221,14 @@ static void initializeDb() const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces(); const QFontDatabaseS60StoreImplementation *store = dynamic_cast(db->s60Store); Q_ASSERT(store); + bool fontAdded = false; for (int i = 0; i < numTypeFaces; i++) { TTypefaceSupport typefaceSupport; QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i); CFont *font; // We have to get a font instance in order to know all the details TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11); - qt_symbian_throwIfError(QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec)); + if (QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone) + continue; if (font->TypeUid() == KCFbsFontUid) { TOpenFontFaceAttrib faceAttrib; const CFbsFont *cfbsFont = dynamic_cast(font); @@ -264,9 +266,12 @@ static void initializeDb() determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange); foreach (const QFontDatabase::WritingSystem system, writingSystems) family->writingSystems[system] = QtFontFamily::Supported; + + fontAdded = true; } QS60Data::screenDevice()->ReleaseFont(font); } + Q_ASSERT(fontAdded); QS60WindowSurface::lockBitmapHeap(); #else // defined(QT_NO_FREETYPE) QDir dir(QDesktopServices::storageLocation(QDesktopServices::FontsLocation)); -- cgit v0.12