From b1bd4021f361b404a9c087622f71006f897d7e52 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 4 Oct 2013 10:28:16 +0200 Subject: [PATCH] Fallback to the original application font handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Qt is built for 10.8 but then used on a machine before 10.8 then it was not falling back correctly when an application font was added. Change-Id: I0f05226cdbcfa36621bb1b3aa2f2cd60e714dfdf Reviewed-by: Morten Johan Sørvig --- .../fontdatabases/mac/qcoretextfontdatabase.mm | 15 +++++++-------- .../fontdatabases/mac/qcoretextfontdatabase_p.h | 3 +-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 0032dc2aff..72486c097d 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -517,8 +517,9 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData CFRelease(font); return families; } - } else { -#else + } else +#endif + { ATSFontContainerRef fontContainer; OSStatus e; @@ -557,10 +558,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData m_applicationFonts.append(fontContainer); return families; } -#endif -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 } -#endif return QStringList(); } @@ -600,13 +598,14 @@ void QCoreTextFontDatabase::removeApplicationFonts() for (int i = 0; i < m_applicationURLFonts.count(); ++i) CTFontManagerUnregisterFontsForURL(m_applicationURLFonts[i], kCTFontManagerScopeProcess, &error); m_applicationURLFonts.clear(); - } -#else + } else +#endif + { for (int i = 0; i < m_applicationFonts.count(); ++i) ATSFontDeactivate(m_applicationFonts[i], 0, kATSOptionFlagsDoNotNotify); m_applicationFonts.clear(); ATSFontNotify(kATSFontNotifyActionFontsChanged, 0); -#endif + } #endif } diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index c3bb4d428a..ee1016509b 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -82,9 +82,8 @@ private: #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 QVector > m_applicationGraphicsFonts; QVector > m_applicationURLFonts; -#else - QVector m_applicationFonts; #endif + QVector m_applicationFonts; #endif };