From e55452259a1b4ec5d17c1e2bc3cc773482c21e5e Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 29 Dec 2009 22:28:43 +0100 Subject: [PATCH] Make fontconfig optional with mingw compiler --- configure.ac | 37 ++++++++++++++++++++++++++++++++++++- poppler/GlobalParams.cc | 9 ++++++--- poppler/GlobalParams.h | 6 +++--- poppler/Makefile.am | 4 ++++ 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 7a8ca19..0ae6dd5 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,7 @@ case "$host_os" in create_shared_lib="-no-undefined" ;; mingw*) + os_win32=yes win32_libs="-lgdi32" create_shared_lib="-no-undefined" auto_import_flags="-Wl,--enable-auto-import" @@ -235,7 +236,40 @@ fi AC_SUBST(FREETYPE_CFLAGS) AC_SUBST(FREETYPE_LIBS) -PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.0.0) +AC_MSG_CHECKING([which font configuration to use]) +AC_ARG_WITH([font_configuration], + [AS_HELP_STRING([--with-font-configuration=fontconfig|win32], + [Select font configuration backend])], + [], + [if test x$os_win32 = xyes; then + # default to win32 on native Windows. + with_font_configuration=win32 + else + # default to fontconig everywhere else. + with_font_configuration=fontconfig + fi + ] +) +AC_MSG_RESULT([$with_font_configuration]) + +case $with_font_configuration in + win32) + AC_DEFINE([WITH_FONTCONFIGURATION_WIN32], + [1],[Use win32 font configuration backend]) + ;; + fontconfig) + AC_DEFINE([WITH_FONTCONFIGURATION_FONTCONFIG], + [1],[Use fontconfig font configuration backend]) + PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.0.0) + ;; + *) + AC_MSG_ERROR( + [Invalid font configuration setting: $with_font_configuration]) + ;; +esac + +AM_CONDITIONAL(BUILD_WITH_WIN32_FONTCONFIGURATION, + test x$with_font_configuration = xwin32) AC_ARG_ENABLE(splash-output, AC_HELP_STRING([--disable-splash-output], @@ -562,6 +596,7 @@ poppler-qt4.pc]) echo "" echo "Building poppler with support for:" +echo " font configuration: $with_font_configuration" echo " splash output: $enable_splash_output" echo " cairo output: $enable_cairo_output" echo " abiword output: $enable_abiword_output" diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc index 2813b98..eda0a34 100644 --- a/poppler/GlobalParams.cc +++ b/poppler/GlobalParams.cc @@ -557,7 +557,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) UnicodeMap *map; int i; -#ifndef _MSC_VER +#if WITH_FONTCONFIGURATION_FONTCONFIG FcInit(); FCcfg = FcConfigGetCurrent(); #endif @@ -962,7 +962,7 @@ static GBool findModifier(const char *name, const char *modifier, const char **s } } -#ifndef _MSC_VER +#if WITH_FONTCONFIGURATION_FONTCONFIG static FcPattern *buildFcPattern(GfxFont *font) { int weight = -1, @@ -1110,7 +1110,7 @@ static FcPattern *buildFcPattern(GfxFont *font) /* if you can't or don't want to use Fontconfig, you need to implement this function for your platform. For Windows, it's in GlobalParamsWin.cc */ -#ifndef _MSC_VER +#if WITH_FONTCONFIGURATION_FONTCONFIG DisplayFontParam *GlobalParams::getDisplayFont(GfxFont *font) { DisplayFontParam *dfp; FcPattern *p=0; @@ -1170,6 +1170,9 @@ fin: return dfp; } #endif +#if WITH_FONTCONFIGURATION_WIN32 +#include "GlobalParamsWin.cc" +#endif GBool GlobalParams::getPSExpandSmaller() { GBool f; diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h index b422e0c..59b2c16 100644 --- a/poppler/GlobalParams.h +++ b/poppler/GlobalParams.h @@ -37,7 +37,7 @@ #include #include "poppler-config.h" #include -#ifndef _MSC_VER +#if WITH_FONTCONFIGURATION_FONTCONFIG #include #endif #include "goo/gtypes.h" @@ -169,7 +169,7 @@ public: void setBaseDir(char *dir); -#ifdef _MSC_VER +#if defined(_MSC_VER) || WITH_FONTCONFIGURATION_WIN32 void setupBaseFonts(char *dir); #endif @@ -352,7 +352,7 @@ private: UnicodeMapCache *unicodeMapCache; CMapCache *cMapCache; -#ifndef _MSC_VER +#if WITH_FONTCONFIGURATION_FONTCONFIG FcConfig *FCcfg; #endif diff --git a/poppler/Makefile.am b/poppler/Makefile.am index ec79e31..22e3e21 100644 --- a/poppler/Makefile.am +++ b/poppler/Makefile.am @@ -1,3 +1,7 @@ +if BUILD_WITH_WIN32_FONTCONFIGURATION +AM_CPPFLAGS = -D_WIN32_IE=0x0501 +endif + if BUILD_SPLASH_OUTPUT splash_sources = \ -- 1.6.0.4