diff options
author | Kristian Rietveld <kris@loopnest.org> | 2015-04-26 23:15:19 +0200 |
---|---|---|
committer | Kristian Rietveld <kris@loopnest.org> | 2015-05-06 20:11:04 +0200 |
commit | 61dd7da69458e8443343eb71d7336b458f834700 (patch) | |
tree | 76d9efd27dc951354d4c26a5f1a4d029d9ef4606 /pango | |
parent | 5b3103d6718af6263a8aa4610e7ac56221399215 (diff) | |
download | pango-61dd7da69458e8443343eb71d7336b458f834700.tar.gz |
coretext: use public function to obtain cascade list if available
We use a compile-time check: if compiling for platforms 10.8 or higher,
use the public function, otherwise use the undocumented function.
Fixes bug 737813.
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pangocoretext-fontmap.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c index 159bedbb..65be3560 100644 --- a/pango/pangocoretext-fontmap.c +++ b/pango/pangocoretext-fontmap.c @@ -1522,10 +1522,12 @@ G_DEFINE_TYPE (PangoCoreTextFontset, pango_core_text_fontset, PANGO_TYPE_FONTSET); +#if !defined(MAC_OS_X_VERSION_10_8) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 /* This symbol does exist in the CoreText library shipped with Snow * Leopard and Lion, however, it is not found in the public header files. */ CFArrayRef CTFontCopyDefaultCascadeList (CTFontRef font_ref); +#endif static PangoCoreTextFontset * pango_core_text_fontset_new (PangoCoreTextFontsetKey *key, @@ -1589,7 +1591,28 @@ pango_core_text_fontset_new (PangoCoreTextFontsetKey *key, fontset->coverages = g_ptr_array_new (); /* Add the cascade list for this language */ +#if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8 + { + CFArrayRef language_pref_list; + CFStringRef languages[1]; + + languages[0] = CFStringCreateWithCString (NULL, + pango_language_to_string (key->language), + kCFStringEncodingASCII); + language_pref_list = CFArrayCreate (kCFAllocatorDefault, + (const void **) languages, + 1, + &kCFTypeArrayCallBacks); + fontset->cascade_list = CTFontCopyDefaultCascadeListForLanguages (pango_core_text_font_get_ctfont (best_font), language_pref_list); + CFRelease (languages[0]); + CFRelease (language_pref_list); + } +#else + /* There is unfortunately no public API to retrieve the cascade list + * on Mac OS X < 10.8, so we use the following undocumented public function. + */ fontset->cascade_list = CTFontCopyDefaultCascadeList (pango_core_text_font_get_ctfont (best_font)); +#endif /* length of cascade list + 1 for the "real" font at the front */ g_ptr_array_set_size (fontset->fonts, CFArrayGetCount (fontset->cascade_list) + 1); |