[cairo] Mac OS X support added

Kristian Høgsberg krh at bitplanet.net
Sun Jan 16 23:02:26 PST 2005


Keith Packard wrote:
...

> Also, in cairoint.h:
> 
>>+#ifdef CAIRO_HAS_FT_FONT
> ...
>>+#elif defined(CAIRO_HAS_ATSUI_FONT)
> ...
>>+#endif
> 
> 
> This should just be
> 
>   #ifdef CAIRO_HAS_FT_FONT
>   ...
>   #endif
> 
>   #ifdef CAIRO_HAS_ATSUI_FONT
>   ...
>   #endif

It would also be good if CAIRO_HAS_FT_FONT and CAIRO_HAS_ATSUI_FONT were 
defined somewhere...  I was thinking something like the attached patch 
would work.  Not sure how much this is going to conflict with Owens font 
work, but it seems like something for the immediate release.

Oh, and by the way, there seems to be missing a ChangeLog entry for the 
Mac OS X changes.

cheers,
Kristian
-------------- next part --------------
Index: configure.in
===================================================================
RCS file: /cvs/cairo/cairo/configure.in,v
retrieving revision 1.69
diff -u -p -r1.69 configure.in
--- configure.in	11 Jan 2005 18:03:01 -0000	1.69
+++ configure.in	17 Jan 2005 06:52:57 -0000
@@ -33,6 +33,7 @@ AC_PROG_CC
 AC_PROG_CPP
 AM_PROG_LIBTOOL
 AC_STDC_HEADERS
+AC_C_BIGENDIAN
 
 AC_CHECK_LIBM
 
@@ -207,14 +208,24 @@ AC_SUBST(SANITY_CHECKING_FEATURE)
 
 dnl ===========================================================================
 
-PKG_CHECK_MODULES(FONTCONFIG, fontconfig)
-CAIRO_CFLAGS="$CAIRO_CFLAGS $FONTCONFIG_CFLAGS"
-CAIRO_LIBS="$CAIRO_LIBS $FONTCONFIG_LIBS"
-
 PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.2)
 CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS"
 
+dnl ===========================================================================
+
+AC_ARG_ENABLE(freetype,
+  [  --disable-freetype      Disable cairo's freetype font backend],
+  [use_freetype=$enableval], [use_freetype=yes])
+
+if test "x$use_freetype" = "xyes"; then
+  PKG_CHECK_MODULES(FONTCONFIG, fontconfig, 
+                    [use_freetype=yes], [use_freetype=no])
+fi
+
+CAIRO_CFLAGS="$CAIRO_CFLAGS $FONTCONFIG_CFLAGS"
+CAIRO_LIBS="$CAIRO_LIBS $FONTCONFIG_LIBS"
+
 # Test for freetype2 separate from pkg-config since at least up to
 # 2003-06-07, there was no freetype2.pc in the release.
 #
@@ -232,34 +243,60 @@ FREETYPE_MIN_RELEASE=2.1.0
 # libtool-specific version - this is what is checked
 FREETYPE_MIN_VERSION=8.0.2
 
-if test -z "$FREETYPE_CONFIG"; then
-  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
-fi
-if test "$FREETYPE_CONFIG" = "no" ; then
-  AC_MSG_ERROR(No freetype-config script found in path or FREETYPE_CONFIG)
-fi
-
-AC_MSG_CHECKING(freetype2 libtool version)
-
-FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
+if test "x$use_freetype" = "xyes"; then
 
-VERSION_DEC=`echo $FREETYPE_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
-MIN_VERSION_DEC=`echo $FREETYPE_MIN_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
-if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
-  AC_MSG_ERROR($FREETYPE_VERSION - version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)
+  if test -z "$FREETYPE_CONFIG"; then
+    AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
+  fi
+  if test "$FREETYPE_CONFIG" = "no" ; then
+    AC_MSG_ERROR(No freetype-config script found in path or FREETYPE_CONFIG)
+  fi
+
+  AC_MSG_CHECKING(freetype2 libtool version)
+
+  FREETYPE_VERSION=`$FREETYPE_CONFIG --version`
+
+  VERSION_DEC=`echo $FREETYPE_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
+  MIN_VERSION_DEC=`echo $FREETYPE_MIN_VERSION | awk -F. '{printf("%d\n", 10000*$1 + 100*$2 + $3)};'`
+  if test $VERSION_DEC -lt $MIN_VERSION_DEC; then
+    AC_MSG_ERROR($FREETYPE_VERSION - version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)
+  fi
+  AC_MSG_RESULT($FREETYPE_VERSION - OK)
+
+  FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
+  FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
+  AC_SUBST(FREETYPE_CFLAGS)
+  AC_SUBST(FREETYPE_LIBS)
 fi
-AC_MSG_RESULT($FREETYPE_VERSION - OK)
-
-FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
-FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
-AC_SUBST(FREETYPE_CFLAGS)
-AC_SUBST(FREETYPE_LIBS)
 
 CAIRO_CFLAGS="$CAIRO_CFLAGS $FREETYPE_CFLAGS"
 CAIRO_LIBS="$CAIRO_LIBS $FREETYPE_LIBS"
 
+if test "x$use_freetype" != "xyes"; then
+  FREETYPE_FONT_FEATURE=CAIRO_HAS_NO_FREETYPE_FONT
+  AM_CONDITIONAL(CAIRO_HAS_FREETYPE_FONT, false)  
+else
+  FREETYPE_FONT_FEATURE=CAIRO_HAS_FREETYPE_FONT
+  AM_CONDITIONAL(CAIRO_HAS_FREETYPE_FONT, true)
+fi
+AC_SUBST(FREETYPE_FONT_FEATURE)
+
 dnl ===========================================================================
 
+AC_ARG_ENABLE(atsui,
+  [  --disable-atsui         Disable cairo's atsui font backend],
+  [use_atsui=$enableval], [use_atsui=no])
+
+if test "x$use_atsui" != "xyes"; then
+  ATSUI_FONT_FEATURE=CAIRO_HAS_NO_ATSUI_FONT
+  AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, false)  
+else
+  ATSUI_FONT_FEATURE=CAIRO_HAS_ATSUI_FONT
+  AM_CONDITIONAL(CAIRO_HAS_ATSUI_FONT, true)
+fi
+AC_SUBST(ATSUI_FONT_FEATURE)
+
+dnl ===========================================================================
 dnl Checks for precise integer types
 AC_CHECK_TYPES([uint64_t, uint128_t])
 
@@ -292,7 +329,7 @@ test/Makefile
 dnl ===========================================================================
 
 echo ""
-echo "cairo will be compiled with the following backends:"
+echo "cairo will be compiled with the following surface backends:"
 echo "  Xlib: $use_xlib"
 echo "  XCB: $use_xcb"
 echo "  PostScript: $use_ps"
@@ -300,4 +337,8 @@ echo "  PDF: $use_pdf"
 echo "  PNG: $use_png"
 echo "  glitz: $use_glitz"
 echo ""
+echo "and the following font backends:"
+echo "  freetype: $use_freetype"
+echo "  atsui: $use_atsui"
+echo ""
 
Index: src/cairo-features.h.in
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-features.h.in,v
retrieving revision 1.11
diff -u -p -r1.11 cairo-features.h.in
--- src/cairo-features.h.in	5 Jan 2005 22:29:31 -0000	1.11
+++ src/cairo-features.h.in	17 Jan 2005 06:52:57 -0000
@@ -49,6 +49,10 @@
 
 #define @GLITZ_SURFACE_FEATURE@
 
+#define @FREETYPE_FONT_FEATURE@
+
+#define @ATSUI_FONT_FEATURE@
+
 #define @SANITY_CHECKING_FEATURE@
 
 #endif
Index: src/cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.82
diff -u -p -r1.82 cairoint.h
--- src/cairoint.h	16 Jan 2005 16:35:14 -0000	1.82
+++ src/cairoint.h	17 Jan 2005 06:52:59 -0000
@@ -500,11 +501,13 @@ typedef struct _cairo_font_backend {
 } cairo_font_backend_t;
 
 /* concrete font backends */
-#ifdef CAIRO_HAS_FT_FONT
+#ifdef CAIRO_HAS_FREETYPE_FONT
 
 extern const cairo_private struct _cairo_font_backend cairo_ft_font_backend;
 
-#elif defined(CAIRO_HAS_ATSUI_FONT)
+#endif
+
+#ifdef CAIRO_HAS_ATSUI_FONT
 
 extern const cairo_private struct _cairo_font_backend cairo_atsui_font_backend;
 
@@ -743,7 +746,7 @@ typedef struct _cairo_traps {
 #define CAIRO_FONT_SLANT_DEFAULT   CAIRO_FONT_SLANT_NORMAL
 #define CAIRO_FONT_WEIGHT_DEFAULT  CAIRO_FONT_WEIGHT_NORMAL
 
-#ifdef CAIRO_HAS_FT_FONT
+#ifdef CAIRO_HAS_FREETYPE_FONT 
 
 #define CAIRO_FONT_FAMILY_DEFAULT  "serif"
 
Index: src/cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.65
diff -u -p -r1.65 cairo.h
--- src/cairo.h	16 Jan 2005 16:35:14 -0000	1.65
+++ src/cairo.h	17 Jan 2005 06:52:59 -0000
@@ -523,7 +523,7 @@ void
 cairo_font_current_transform (cairo_font_t *font, 
 			      cairo_matrix_t *matrix);
 
-#if CAIRO_HAS_FT_FONT
+#if CAIRO_HAS_FREETYPE_FONT
 /* Fontconfig/Freetype platform-specific font interface */
 
 #include <fontconfig/fontconfig.h>
@@ -542,7 +542,7 @@ cairo_ft_font_face (cairo_font_t *ft_fon
 FcPattern *
 cairo_ft_font_pattern (cairo_font_t  *ft_font);
 
-#endif  /* CAIRO_HAS_FT_FONT */
+#endif  /* CAIRO_HAS_FREETYPE_FONT */
 
 /* Image functions */
 


More information about the cairo mailing list