--- poppler-0.11.0/configure.ac 2009-05-11 20:14:03.000000000 +0200 +++ poppler-0.11.0/configure.ac 2009-06-11 11:11:04.000000000 +0200 @@ -32,6 +32,8 @@ AC_DEFINE([MULTITHREADED], [1], [Enable multithreading support.]) AC_DEFINE([TEXTOUT_WORD_LIST], [1], [Enable word list support.]) +AC_CANONICAL_HOST + dnl Check for OS specific flags win32_libs="" create_shared_lib="" @@ -41,12 +43,17 @@ win32_libs="-lgdi32" create_shared_lib="-no-undefined" auto_import_flags="-Wl,--enable-auto-import" - ;; + os_win32=yes + ;; + *) + os_win32=no + ;; esac AC_SUBST(win32_libs) AC_SUBST(create_shared_lib) AC_SUBST(auto_import_flags) +AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes") ACX_PTHREAD() --- poppler-0.11.0/poppler/GlobalParams.cc 2009-01-15 20:29:53.000000000 +0100 +++ poppler-0.11.0/poppler/GlobalParams.cc 2009-06-11 10:43:36.000000000 +0200 @@ -41,6 +41,7 @@ #endif #ifdef WIN32 # include +# include #endif #include "goo/gmem.h" #include "goo/GooString.h" @@ -139,6 +140,58 @@ #ifdef WIN32 +/* search for data relative to where we are installed */ + +static HMODULE hmodule; + +extern "C" { +BOOL WINAPI +DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + switch (fdwReason) + { + case DLL_PROCESS_ATTACH: + hmodule = hinstDLL; + break; + } + + return TRUE; +} +} + +static char * +get_poppler_datadir (void) +{ + static char retval[1000]; + static int beenhere = 0; + + unsigned char *p; + + if (beenhere) + return retval; + + if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10)) + return POPPLER_DATADIR; + + p = _mbsrchr ((const unsigned char *) retval, '\\'); + *p = '\0'; + p = _mbsrchr ((const unsigned char *) retval, '\\'); + if (p) { + if (stricmp ((const char *) (p+1), "bin") == 0) + *p = '\0'; + } + strcat (retval, "\\share\\poppler"); + + beenhere = 1; + + return retval; +} + +#undef POPPLER_DATADIR +#define POPPLER_DATADIR get_poppler_datadir () + //------------------------------------------------------------------------ // WinFontInfo //------------------------------------------------------------------------ @@ -554,7 +607,7 @@ UnicodeMap *map; int i; -#ifndef _MSC_VER +#ifndef _WIN32 FcInit(); FCcfg = FcConfigGetCurrent(); #endif @@ -957,7 +1010,7 @@ } } -#ifndef _MSC_VER +#ifndef _WIN32 static FcPattern *buildFcPattern(GfxFont *font) { int weight = -1, @@ -1105,7 +1158,7 @@ /* 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 +#ifndef _WIN32 DisplayFontParam *GlobalParams::getDisplayFont(GfxFont *font) { DisplayFontParam *dfp; FcPattern *p=0; --- poppler-0.11.0/poppler/GlobalParams.h 2009-01-10 18:24:40.000000000 +0100 +++ poppler-0.11.0/poppler/GlobalParams.h 2009-06-11 10:43:29.000000000 +0200 @@ -35,7 +35,7 @@ #include #include "poppler-config.h" #include -#ifndef _MSC_VER +#ifndef _WIN32 #include #endif #include "goo/gtypes.h" @@ -166,7 +166,7 @@ void setBaseDir(char *dir); -#ifdef _MSC_VER +#ifdef _WIN32 void setupBaseFonts(char *dir); #endif @@ -345,7 +345,7 @@ UnicodeMapCache *unicodeMapCache; CMapCache *cMapCache; -#ifndef _MSC_VER +#ifndef _WIN32 FcConfig *FCcfg; #endif --- poppler-0.11.0/poppler/Makefile.am 2009-05-11 20:15:11.000000000 +0200 +++ poppler-0.11.0/poppler/Makefile.am 2009-06-11 11:33:02.000000000 +0200 @@ -109,6 +109,11 @@ cms_libs = -llcms endif +if OS_WIN32 +font_sources = \ + GlobalParamsWin.cc +endif + INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/goo \ @@ -217,6 +222,7 @@ $(zlib_sources) \ $(libjpeg2000_sources) \ $(abiword_sources) \ + $(font_sources) \ Annot.cc \ Array.cc \ BuiltinFont.cc \ Only in poppler-0.11.0/poppler: poppler-config.h