[cairo] XRender and fontconfig in cairo-xlib-screen.c should be conditional?

mpsuzuki at hiroshima-u.ac.jp mpsuzuki at hiroshima-u.ac.jp
Thu Sep 21 17:33:33 PDT 2006


Hi,

Although I'm not sure if xlib surface without freetype2 backend
is still usable, configure script allows me to configure xlib
surface backend without freetype2, fontconfig and xrender.

If it is designed to do so (xlib without font backend is permitted),
I wish a few conditionals are introduced in cairo-xlib-screen.c
to mask fontconfig/xrender dependent part.

Regards,
mpsuzuki


diff -Burb cairo-1.2.4.orig/configure.in cairo-1.2.4/configure.in
--- cairo-1.2.4.orig/configure.in	Sat Aug 19 09:35:54 2006
+++ cairo-1.2.4/configure.in	Wed Sep  6 21:40:51 2006
@@ -250,6 +250,10 @@
 				       [use_xlib_xrender="no (requires Xrender http://freedesktop.org/Software/xlibs)"])])
   fi
 ])
+if test "x$use_xlib_xrender" = "xyes"; then
+  AC_DEFINE([HAVE_X11_EXTENSIONS_XRENDER_H], 1, [have Xrender.h])
+fi
+AC_SUBST(HAVE_X11_EXTENSIONS_XRENDER_H)
 
 dnl ===========================================================================
 
@@ -463,6 +467,12 @@
   LIBS="$temp_save_libs"
   CFLAGS="$temp_save_cflags"
 fi
+
+if test "x$use_ft" = "xyes"; then
+  AC_DEFINE([HAVE_FONTCONFIG_FONTCONFIG_H], 1, [have fontconfig.h])
+fi
+AC_SUBST([HAVE_FONTCONFIG_FONTCONFIG_H])
+
 
 dnl ===========================================================================
 
diff -Burb cairo-1.2.4.orig/src/cairo-xlib-screen.c cairo-1.2.4/src/cairo-xlib-screen.c
--- cairo-1.2.4.orig/src/cairo-xlib-screen.c	Fri Aug 11 05:14:47 2006
+++ cairo-1.2.4/src/cairo-xlib-screen.c	Wed Sep  6 16:54:15 2006
@@ -54,12 +54,17 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "config.h"
 #include "cairo-xlib-private.h"
 
+#ifdef HAVE_FONTCONFIG_FONTCONFIG_H
 #include <fontconfig/fontconfig.h>
+#endif
 
 #include <X11/Xlibint.h>	/* For XESetCloseDisplay */
+#ifdef HAVE_X11_EXTENSIONS_XRENDER_H
 #include <X11/extensions/Xrender.h>
+#endif
 
 static int
 parse_boolean (const char *v)
@@ -113,8 +118,10 @@
 
     v = XGetDefault (dpy, "Xft", option);
     if (v) {
+#ifdef HAVE_FONTCONFIG_FONTCONFIG_H
 	if (FcNameConstant ((FcChar8 *) v, value))
 	    return TRUE;
+#endif
 
 	i = strtol (v, &e, 0);
 	if (e != v)


More information about the cairo mailing list