shithub: freetype+ttf2subf

Download patch

ref: f3a924dd53346dbb9da36f4917ff017b2b2cfd96
parent: ce8853af8158368eae51b14c89dc3b79f48ce8ce
author: Suzuki, Toshiya (鈴木俊哉) <[email protected]>
date: Tue Jun 24 13:13:58 EDT 2008

Fix for 10.4u SDK bundled to Mac OS X 10.5

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-06-24  suzuki toshiya <[email protected]>
+
+	* builds/unix/configure.raw: Check type "ResourceIndex" explicitly
+	and define HAVE_TYPE_RESOURCE_INDEX if it is defined. Mac OS X
+	10.5 bundles 10.4u SDK with MAC_OS_X_VERSION_10_5 macro but without
+	ResourceIndex type definition. The macro does not inform the type
+	availability.
+	* src/base/ftmac.c: More parentheses are inserted to clarify the
+	conditionals to disable legacy APIs in "10.5 and later" cases.
+	If HAVE_TYPE_RESOURCE_INDEX is not defined, ResourceIndex is
+	defined.
+
 2008-06-24  Werner Lemberg  <[email protected]>
 
 	* src/truetype/ttinterp. (Ins_SCANTYPE): Don't check rendering mode.
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -260,7 +260,37 @@
        ],
        [AC_MSG_RESULT([no, ANSI incompatible])
         CFLAGS="$orig_CFLAGS"
-       ])],
+       ])
+     AC_MSG_CHECKING([type ResourceIndex])
+     orig_CFLAGS="$CFLAGS"
+     CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
+     AC_COMPILE_IFELSE([
+       AC_LANG_PROGRAM([
+
+#if defined(__GNUC__) && defined(__APPLE_CC__)
+# include <Carbon/Carbon.h>
+# include <ApplicationServices/ApplicationServices.h>
+#else
+# include <ConditionalMacros.h>
+# include <Files.h>
+# include <Resources.h>
+#endif
+
+         ],
+         [
+
+           ResourceIndex i = 0;
+           return i;
+
+         ])],
+       [AC_MSG_RESULT([ok])
+        CFLAGS="$orig_CFLAGS"
+        CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX"
+       ],
+       [AC_MSG_RESULT([no])
+        CFLAGS="$orig_CFLAGS"
+       ])
+    ],
     [AC_MSG_RESULT([not found])
      LDFLAGS="${orig_LDFLAGS}"
      CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -77,8 +77,8 @@
 #define OS_INLINE  static __inline__
 #endif
 
-  /* The ResourceIndex type was only added in the 10.5 SDK */
-#ifndef MAC_OS_X_VERSION_10_5
+  /* The ResourceIndex type was available SDKs on 10.5 */
+#ifndef HAVE_TYPE_RESOURCE_INDEX
 typedef short ResourceIndex;
 #endif
 
@@ -134,7 +134,7 @@
                               FSRef*      ats_font_ref )
   {
 #if defined( MAC_OS_X_VERSION_10_5 ) && \
-    MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+    ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
  
     OSStatus  err;
 
@@ -235,7 +235,7 @@
                                 FT_Long*     face_index )
   {
 #if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
-      MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
+      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
     FT_UNUSED( fontName );
     FT_UNUSED( pathSpec );
     FT_UNUSED( face_index );
@@ -1108,7 +1108,7 @@
                            FT_Face*       aface )
   {
 #if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
-      MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
+      ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
     FT_UNUSED( library );
     FT_UNUSED( spec );
     FT_UNUSED( face_index );