Fallback to the original application font handling

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 <morten.sorvig@digia.com>
This commit is contained in:
Andy Shaw 2013-10-04 10:28:16 +02:00 committed by The Qt Project
parent 2cfca47d56
commit b1bd4021f3
2 changed files with 8 additions and 10 deletions

View File

@ -517,8 +517,9 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
CFRelease(font); CFRelease(font);
return families; return families;
} }
} else { } else
#else #endif
{
ATSFontContainerRef fontContainer; ATSFontContainerRef fontContainer;
OSStatus e; OSStatus e;
@ -557,10 +558,7 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData
m_applicationFonts.append(fontContainer); m_applicationFonts.append(fontContainer);
return families; return families;
} }
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
} }
#endif
return QStringList(); return QStringList();
} }
@ -600,13 +598,14 @@ void QCoreTextFontDatabase::removeApplicationFonts()
for (int i = 0; i < m_applicationURLFonts.count(); ++i) for (int i = 0; i < m_applicationURLFonts.count(); ++i)
CTFontManagerUnregisterFontsForURL(m_applicationURLFonts[i], kCTFontManagerScopeProcess, &error); CTFontManagerUnregisterFontsForURL(m_applicationURLFonts[i], kCTFontManagerScopeProcess, &error);
m_applicationURLFonts.clear(); m_applicationURLFonts.clear();
} } else
#else #endif
{
for (int i = 0; i < m_applicationFonts.count(); ++i) for (int i = 0; i < m_applicationFonts.count(); ++i)
ATSFontDeactivate(m_applicationFonts[i], 0, kATSOptionFlagsDoNotNotify); ATSFontDeactivate(m_applicationFonts[i], 0, kATSOptionFlagsDoNotNotify);
m_applicationFonts.clear(); m_applicationFonts.clear();
ATSFontNotify(kATSFontNotifyActionFontsChanged, 0); ATSFontNotify(kATSFontNotifyActionFontsChanged, 0);
#endif }
#endif #endif
} }

View File

@ -82,9 +82,8 @@ private:
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_8
QVector<QCFType<CGFontRef> > m_applicationGraphicsFonts; QVector<QCFType<CGFontRef> > m_applicationGraphicsFonts;
QVector<QCFType<CFURLRef> > m_applicationURLFonts; QVector<QCFType<CFURLRef> > m_applicationURLFonts;
#else
QVector<ATSFontContainerRef> m_applicationFonts;
#endif #endif
QVector<ATSFontContainerRef> m_applicationFonts;
#endif #endif
}; };