1 From 9d460070fca2c0a61aac60ba7cad6f9a6af82309 Mon Sep 17 00:00:00 2001
2 From: Andrea Canciani <ranma42@gmail.com>
3 Date: Tue, 9 Dec 2014 16:13:00 +0100
4 Subject: [PATCH] quartz: Remove call to obsolete CGFontGetGlyphPath
6 CGFontGetGlyphPath was not public and is not available anymore on
7 modern OSX/iOS systems. The same functionality is available through
8 the CoreText API since OSX 10.5.
10 Based on a patch by Simon Cozens.
12 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84324
14 src/cairo-quartz-font.c | 10 ++++------
15 1 file changed, 4 insertions(+), 6 deletions(-)
17 diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
18 index e6a379a..02f3426 100644
19 --- a/src/cairo-quartz-font.c
20 +++ b/src/cairo-quartz-font.c
21 @@ -81,9 +81,6 @@ static void (*CGFontGetGlyphsForUnicharsPtr) (CGFontRef, const UniChar[], const
22 static void (*CGContextSetAllowsFontSmoothingPtr) (CGContextRef, bool) = NULL;
23 static bool (*CGContextGetAllowsFontSmoothingPtr) (CGContextRef) = NULL;
25 -/* Not public in the least bit */
26 -static CGPathRef (*CGFontGetGlyphPathPtr) (CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph) = NULL;
28 /* CGFontGetHMetrics isn't public, but the other functions are public/present in 10.5 */
31 @@ -127,7 +124,6 @@ quartz_font_ensure_symbols(void)
32 /* These have the same name in 10.4 and 10.5 */
33 CGFontGetUnitsPerEmPtr = dlsym(RTLD_DEFAULT, "CGFontGetUnitsPerEm");
34 CGFontGetGlyphAdvancesPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphAdvances");
35 - CGFontGetGlyphPathPtr = dlsym(RTLD_DEFAULT, "CGFontGetGlyphPath");
37 CGFontGetHMetricsPtr = dlsym(RTLD_DEFAULT, "CGFontGetHMetrics");
38 CGFontGetAscentPtr = dlsym(RTLD_DEFAULT, "CGFontGetAscent");
39 @@ -144,7 +140,6 @@ quartz_font_ensure_symbols(void)
40 CGFontGetGlyphsForUnicharsPtr &&
41 CGFontGetUnitsPerEmPtr &&
42 CGFontGetGlyphAdvancesPtr &&
43 - CGFontGetGlyphPathPtr &&
44 (CGFontGetHMetricsPtr || (CGFontGetAscentPtr && CGFontGetDescentPtr && CGFontGetLeadingPtr)))
45 _cairo_quartz_font_symbols_present = TRUE;
47 @@ -550,6 +545,7 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
48 CGGlyph glyph = _cairo_quartz_scaled_glyph_index (scaled_glyph);
49 CGAffineTransform textMatrix;
52 cairo_path_fixed_t *path;
54 if (glyph == INVALID_GLYPH) {
55 @@ -564,7 +560,9 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
59 - glyphPath = CGFontGetGlyphPathPtr (font_face->cgFont, &textMatrix, 0, glyph);
60 + ctFont = CTFontCreateWithGraphicsFont (font_face->cgFont, 1.0, NULL, NULL);
61 + glyphPath = CTFontCreatePathForGlyph (ctFont, glyph, &textMatrix);
64 return CAIRO_INT_STATUS_UNSUPPORTED;