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

Behdad Esfahbod behdad at behdad.org
Fri Sep 22 16:34:51 PDT 2006


On Thu, 2006-09-21 at 20:33 -0400, mpsuzuki at hiroshima-u.ac.jp wrote:
> 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.

I like your patch.  Just:

  - It's not complete as you already mentioned.

  - You should simply use CAIRO_HAS_FT_FONT and
CAIRO_HAS_XLIB_XRENDER_SURFACE that are defined in cairo-features.h

Feel free to submit a complete version.

behdad


> 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)
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://cairographics.org/cgi-bin/mailman/listinfo/cairo
-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"



More information about the cairo mailing list