Fixes for the 'xamarin' profile.
[mono.git] / bockbuild / MacSDK / patches / cairo-fix-CGFontGetGlyphPath-deprecation.patch
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
5
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.
9
10 Based on a patch by Simon Cozens.
11
12 Fixes https://bugs.freedesktop.org/show_bug.cgi?id=84324
13 ---
14  src/cairo-quartz-font.c | 10 ++++------
15  1 file changed, 4 insertions(+), 6 deletions(-)
16
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;
24
25 -/* Not public in the least bit */
26 -static CGPathRef (*CGFontGetGlyphPathPtr) (CGFontRef fontRef, CGAffineTransform *textTransform, int unknown, CGGlyph glyph) = NULL;
27 -
28  /* CGFontGetHMetrics isn't public, but the other functions are public/present in 10.5 */
29  typedef struct {
30      int ascent;
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");
36
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;
46
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;
50      CGPathRef glyphPath;
51 +    CTFontRef ctFont;
52      cairo_path_fixed_t *path;
53
54      if (glyph == INVALID_GLYPH) {
55 @@ -564,7 +560,9 @@ _cairo_quartz_init_glyph_path (cairo_quartz_scaled_font_t *font,
56                                         -font->base.scale.yy,
57                                         0, 0);
58
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);
62 +    CFRelease (ctFont);
63      if (!glyphPath)
64         return CAIRO_INT_STATUS_UNSUPPORTED;
65
66 --
67 1.9.3 (Apple Git-50)