From 83df69de04c9fd91dfa222f10d8845d0c8c7bf9d Mon Sep 17 00:00:00 2001 From: ellson Date: Tue, 24 Jul 2007 13:21:36 +0000 Subject: [PATCH] fix breakage caused by using fontconfig for dot -v --- configure.ac | 86 ++++++++++--------------------- plugin/pango/Makefile.am | 2 +- plugin/pango/gvtextlayout_pango.c | 10 ++-- 3 files changed, 36 insertions(+), 62 deletions(-) diff --git a/configure.ac b/configure.ac index c7af82a99..9cce7660a 100644 --- a/configure.ac +++ b/configure.ac @@ -1362,6 +1362,29 @@ AC_SUBST(PANGOCAIRO_LIBS) fi AM_CONDITIONAL(WITH_PANGOCAIRO, [test "x$HAVE_PANGOCAIRO" != "x"]) +dnl ----------------------------------- +dnl INCLUDES and LIBS for FONTCONFIG + +AC_ARG_WITH(fontconfig, + [AC_HELP_STRING([--with-fontconfig], + [use fontconfig library])]) + +### default is to build with fontconfig +if test "x$with_fontconfig" != "xno"; then + with_fontconfig=yes +fi + +if test "x$with_fontconfig" = "xyes"; then +PKG_CHECK_MODULES(FONTCONFIG, [fontconfig >= 1.0], + [HAVE_FONTCONFIG=1 + AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG,1, + [Define if you have the fontconfig library])], + [AC_MSG_WARN(fontconfig library not available)]) +AC_SUBST(FONTCONFIG_CFLAGS) +AC_SUBST(FONTCONFIG_LIBS) +fi +AM_CONDITIONAL(WITH_FONTCONFIG, [test "x$HAVE_FONTCONFIG" != "x"]) + dnl ----------------------------------- dnl INCLUDES and LIBS for GTK. @@ -1659,64 +1682,11 @@ dnl ---------------------------------- dnl INCLUDES and LIBS for FONTCONFIG (only with mylibgd) if test "x$with_mylibgd" = "xyes"; then - -AC_ARG_WITH(fontconfig, - [AC_HELP_STRING([--with-fontconfig], - [use fontconfig library])]) - -### default is to build with fontconfig -if test "x$with_fontconfig" != "xno"; then - with_fontconfig=yes -fi - -if test "x$with_fontconfig" = "xyes"; then -save_CPPFLAGS=$CPPFLAGS -save_LDFLAGS=$LDFLAGS -FC_INCLUDES="" -FC_LIBS="" -AC_PATH_PROG(FONTCONFIG_CONFIG,fontconfig-config) -if test -n "$FONTCONFIG_CONFIG"; then - fc_cflags=`$FONTCONFIG_CONFIG --cflags` - if test "$fc_cflags" != "-I/usr/include" ; then - FC_INCLUDES="$fc_cflags" - fi - fc_prefix=`$FONTCONFIG_CONFIG --prefix` - if test "$fc_prefix" != "/usr" ; then - FC_LIBS="-L${fc_prefix}/lib" - fi -fi - -PKG_CHECK_MODULES(FONTCONFIG, fontconfig, - [AC_DEFINE_UNQUOTED(HAVE_FONTCONFIG,1, - [Define if you have the fontconfig library])], - [AC_MSG_WARN(Optional fontconfig library not available)]) - -if test "x$HAVE_FONTCONFIG" = "x1"; then - FC_INCLUDES=$(FONTCONFIG_INCLUDES) - FC_LIBS=$(FONTCONFIG_LIBS) -fi - -AC_ARG_WITH(fontconfigincludedir, - [ --with-fontconfigincludedir=DIR use FONTCONFIG includes from DIR], - FC_INCLUDES="-I$withval") -CPPFLAGS="$CPPFLAGS $FC_INCLUDES" -AC_ARG_WITH(fontconfiglibdir, - [ --with-fontconfiglibdir=DIR use FONTCONFIG libraries from DIR], - [FC_LIBS="-L$withval"]) -LDFLAGS="$LDFLAGS $FC_LIBS" -AC_CHECK_HEADERS(fontconfig/fontconfig.h) -if test `eval echo '${'$as_ac_Header'}'` = yes; then - AC_CHECK_LIB(fontconfig,FcGetVersion, - [FC_LIBS="$FC_LIBS -lfontconfig" - AC_DEFINE_UNQUOTED(HAVE_GD_FONTCONFIG,1,[Define if the GD library has the GD_FONTCONFIG feature]) - - AC_DEFINE_UNQUOTED(HAVE_LIBFONTCONFIG,1,[Define if you have the FONTCONFIG library])], - [AC_MSG_WARN(Optional FONTCONFIG library not available - no libfontconfig.)]) -else - AC_MSG_WARN(Optional FONTCONFIG library not available - no fontconfig/fontconfig.h) -fi -CPPFLAGS=$save_CPPFLAGS -LDFLAGS=$save_LDFLAGS +if test "x$HAVE_FONTCONFIG" != "x"; then +FC_INCLUDES="$FONTCONFIG_INCLUDES" +FC_LIBS="$FONTCONFIG_LIBS" +AC_DEFINE_UNQUOTED(HAVE_GD_FONTCONFIG,1,[Define if the GD library has the GD_FONTCONFIG feature]) +AC_DEFINE_UNQUOTED(HAVE_LIBFONTCONFIG,1,[Define if you have the FONTCONFIG library])], AC_SUBST(FC_INCLUDES) AC_SUBST(FC_LIBS) fi diff --git a/plugin/pango/Makefile.am b/plugin/pango/Makefile.am index 2894c0f7d..bfff02b07 100644 --- a/plugin/pango/Makefile.am +++ b/plugin/pango/Makefile.am @@ -23,7 +23,7 @@ libgvplugin_pango_C_la_SOURCES = \ libgvplugin_pango_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined libgvplugin_pango_la_SOURCES = $(libgvplugin_pango_C_la_SOURCES) -libgvplugin_pango_la_LIBADD = @PANGOCAIRO_LIBS@ @MATH_LIBS@ +libgvplugin_pango_la_LIBADD = @PANGOCAIRO_LIBS@ @FONTCONFIG_LIBS@ @MATH_LIBS@ EXTRA_DIST = Makefile.old diff --git a/plugin/pango/gvtextlayout_pango.c b/plugin/pango/gvtextlayout_pango.c index 2da0e54f0..297c57ab9 100644 --- a/plugin/pango/gvtextlayout_pango.c +++ b/plugin/pango/gvtextlayout_pango.c @@ -19,13 +19,13 @@ #endif #include -#ifdef HAVE_FONTCONFIG -#include -#endif #include "gvplugin_textlayout.h" #ifdef HAVE_PANGOCAIRO #include +#ifdef HAVE_FONTCONFIG +#include +#endif static void pango_free_layout (void *layout) { @@ -88,6 +88,7 @@ static boolean pango_textlayout(GVCOMMON_t *common, textpara_t * para, char **fo desc = pango_font_description_from_string(fnt); if (fontpath) { /* -v support */ +#ifdef HAVE_FONTCONFIG FcPattern *pat, *match; FcFontSet *fs; FcResult result; @@ -122,6 +123,9 @@ static boolean pango_textlayout(GVCOMMON_t *common, textpara_t * para, char **fo } *fontpath = buf; FcFontSetDestroy(fs); +#else + *fontpath = fnt; +#endif } } pango_font_description_set_size (desc, (gint)(para->fontsize * PANGO_SCALE)); -- 2.50.1