diff --git a/libass/ass_coretext.c b/libass/ass_coretext.c index 030ff8e..7766ff1 100644 --- libass/ass_coretext.c +++ libass/ass_coretext.c @@ -86,17 +86,18 @@ static bool check_glyph(void *priv, uint32_t code) static char *get_font_file(CTFontDescriptorRef fontd) { CFURLRef url = NULL; - if (false) {} #ifdef MAC_OS_X_VERSION_10_6 // Declared in SDKs since 10.6, including iOS SDKs - else if (CHECK_AVAILABLE(kCTFontURLAttribute, macOS 10.6, *)) { + if (CHECK_AVAILABLE(kCTFontURLAttribute, macOS 10.6, *)) { url = CTFontDescriptorCopyAttribute(fontd, kCTFontURLAttribute); } #endif -#if !TARGET_OS_IPHONE && MAC_OS_X_VERSION_MIN_REQUIRED < 1060 - // ATS is declared deprecated in newer macOS SDKs - // and not declared at all in iOS SDKs - else { +#if !TARGET_OS_IPHONE && MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + // ATS is declared deprecated in newer macOS SDKs and not declared at all + // in iOS SDKs, but is still available up to and including 10.6/10.7. On + // 10.6, kCTFontURLAttribute is declared but CTFontDescriptorCopyAttribute() + // often returns NULL for it, so fall back to ATS to resolve the font file. + if (!url) { CTFontRef font = CTFontCreateWithFontDescriptor(fontd, 0, NULL); if (!font) return NULL;