diff options
Diffstat (limited to 'src/cairo-quartz-font.c')
-rw-r--r-- | src/cairo-quartz-font.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c index 8b34ed81..53d5c35f 100644 --- a/src/cairo-quartz-font.c +++ b/src/cairo-quartz-font.c @@ -93,6 +93,9 @@ static int (*CGFontGetAscentPtr) (CGFontRef fontRef) = NULL; static int (*CGFontGetDescentPtr) (CGFontRef fontRef) = NULL; static int (*CGFontGetLeadingPtr) (CGFontRef fontRef) = NULL; +/* Not public anymore in 64-bits nor in 10.7 */ +static ATSFontRef (*FMGetATSFontRefFromFontPtr) (FMFont iFont) = NULL; + static cairo_bool_t _cairo_quartz_font_symbol_lookup_done = FALSE; static cairo_bool_t _cairo_quartz_font_symbols_present = FALSE; @@ -132,6 +135,8 @@ quartz_font_ensure_symbols(void) CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing"); CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing"); + FMGetATSFontRefFromFontPtr = dlsym(RTLD_DEFAULT, "FMGetATSFontRefFromFont"); + if ((CGFontCreateWithFontNamePtr || CGFontCreateWithNamePtr) && CGFontGetGlyphBBoxesPtr && CGFontGetGlyphsForUnicharsPtr && @@ -805,7 +810,6 @@ _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *abstract_font) return ffont->cgFont; } -#ifndef __LP64__ /* * compat with old ATSUI backend */ @@ -826,15 +830,22 @@ _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *abstract_font) cairo_font_face_t * cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id) { - ATSFontRef atsFont = FMGetATSFontRefFromFont (font_id); - CGFontRef cgFont = CGFontCreateWithPlatformFont (&atsFont); - cairo_font_face_t *ff; + quartz_font_ensure_symbols(); - ff = cairo_quartz_font_face_create_for_cgfont (cgFont); + if (FMGetATSFontRefFromFontPtr != NULL) { + ATSFontRef atsFont = FMGetATSFontRefFromFontPtr (font_id); + CGFontRef cgFont = CGFontCreateWithPlatformFont (&atsFont); + cairo_font_face_t *ff; - CGFontRelease (cgFont); + ff = cairo_quartz_font_face_create_for_cgfont (cgFont); + + CGFontRelease (cgFont); - return ff; + return ff; + } else { + _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); + return (cairo_font_face_t *)&_cairo_font_face_nil; + } } /* This is the old name for the above function, exported for compat purposes */ @@ -845,4 +856,3 @@ cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id) { return cairo_quartz_font_face_create_for_atsu_font_id (font_id); } -#endif |