#ifdef SK_BUILD_FOR_IOS
#include <CoreText/CoreText.h>
+#include <CoreText/CTFontManager.h>
#include <CoreGraphics/CoreGraphics.h>
#include <CoreFoundation/CoreFoundation.h>
#endif
class SkScalerContext_Mac;
+// CTFontManagerCopyAvailableFontFamilyNames() is not always available, so we
+// provide a wrapper here that will return an empty array if need be.
+static CFArrayRef SkCTFontManagerCopyAvailableFontFamilyNames() {
+#ifdef SK_BUILD_FOR_IOS
+ return CFArrayCreate(NULL, NULL, 0, NULL);
+#else
+ return CTFontManagerCopyAvailableFontFamilyNames();
+#endif
+}
+
+
// Being templated and taking const T* prevents calling
// CFSafeRelease(autoCFRelease) through implicit conversion.
template <typename T> static void CFSafeRelease(/*CFTypeRef*/const T* cfTypeRef) {
void lazyInit() {
if (NULL == fNames) {
- fNames = CTFontManagerCopyAvailableFontFamilyNames();
+ fNames = SkCTFontManagerCopyAvailableFontFamilyNames();
fCount = fNames ? CFArrayGetCount(fNames) : 0;
}
}