[gtk-osx] Patch Cairo to work around FMGetATSFontRefFromFontPtr being hidden in Lion & Later



commit e2da0471435875bd0b2ac24bcd66acd675f874bf
Author: John Ralls <jralls ceridwen us>
Date:   Sun Mar 4 14:25:12 2012 -0800

    Patch Cairo to work around FMGetATSFontRefFromFontPtr being hidden in Lion & Later

 modulesets-stable/gtk-osx.modules                  |    5 +-
 ...artz-Fix-the-32-bits-build-on-MacOSX-10.7.patch |  102 ++++++++++++++++++++
 2 files changed, 104 insertions(+), 3 deletions(-)
---
diff --git a/modulesets-stable/gtk-osx.modules b/modulesets-stable/gtk-osx.modules
index c902be6..4b99c4e 100644
--- a/modulesets-stable/gtk-osx.modules
+++ b/modulesets-stable/gtk-osx.modules
@@ -229,9 +229,8 @@
     <branch module="cairo-1.10.2.tar.gz"  version="1.10.2"
             repo="cairographics"
             hash="sha1:ccce5ae03f99c505db97c286a0c9a90a926d3c6e">
-      <patches>
-        <patch  file="http://git.gnome.org/browse/gtk-osx/plain/patches/Cairo-44584-llvm-no-flto.patch"/>
-      </patches>
+      <patch  file="http://git.gnome.org/browse/gtk-osx/plain/patches/Cairo-44584-llvm-no-flto.patch"; strip="1"/>
+      <patch file="http://git.gnome.org/browse/gtk-osx/plain/patches/0001-quartz-Fix-the-32-bits-build-on-MacOSX-10.7.patch"; strip="1"/>
     </branch>
     <dependencies>
       <dep package="pixman"/>
diff --git a/patches/0001-quartz-Fix-the-32-bits-build-on-MacOSX-10.7.patch b/patches/0001-quartz-Fix-the-32-bits-build-on-MacOSX-10.7.patch
new file mode 100644
index 0000000..139dcb1
--- /dev/null
+++ b/patches/0001-quartz-Fix-the-32-bits-build-on-MacOSX-10.7.patch
@@ -0,0 +1,102 @@
+From 1f6a1aaaa75e4c4796bb376140af0213afa32881 Mon Sep 17 00:00:00 2001
+From: Andrea Canciani <ranma42 gmail com>
+Date: Sat, 3 Sep 2011 09:39:24 -0700
+Subject: [PATCH] quartz: Fix the 32-bits build on MacOSX 10.7
+
+FMGetATSFontRefFromFont() is not public on Lion nor on 64-bits
+Frameworks, but it seems to be available in the dynamic libs, hence we
+can dlsym() it just like other private functions.
+
+Works around the error:
+cairo-quartz-font.c: In function 'cairo_quartz_font_face_create_for_atsu_font_id':
+cairo-quartz-font.c:830: error: implicit declaration of function 'FMGetATSFontRefFromFont'
+
+Fixes https://bugs.freedesktop.org/show_bug.cgi?id=39493
+---
+ src/cairo-quartz-font.c |   26 ++++++++++++++++++--------
+ src/cairo-quartz.h      |    2 --
+ 2 files changed, 18 insertions(+), 10 deletions(-)
+
+diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
+index 2c7e017..d8ec919 100644
+--- a/src/cairo-quartz-font.c
++++ b/src/cairo-quartz-font.c
+@@ -90,6 +90,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;
+ 
+@@ -127,6 +130,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 &&
+@@ -777,7 +782,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
+  */
+@@ -798,15 +802,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 */
+@@ -817,4 +828,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
+diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
+index 8d001c5..9be5f9a 100644
+--- a/src/cairo-quartz.h
++++ b/src/cairo-quartz.h
+@@ -66,10 +66,8 @@ cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
+ cairo_public cairo_font_face_t *
+ cairo_quartz_font_face_create_for_cgfont (CGFontRef font);
+ 
+-#ifndef __LP64__
+ cairo_public cairo_font_face_t *
+ cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id);
+-#endif
+ 
+ #endif /* CAIRO_HAS_QUARTZ_FONT */
+ 
+-- 
+1.7.7.5 (Apple Git-28)
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]