From c0371a07a678bebf2e6991c94eb245ec1c3f95cf Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sat, 8 Feb 2014 20:35:33 +0800 Subject: [PATCH] fix build for latest poppler and fontforge --- CMakeLists.txt | 16 +++++++++++++--- src/util/ffw.c | 2 +- src/util/unicode.cc | 5 ++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 360e5f9..9f9b9f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,13 +17,23 @@ add_custom_target(dist WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) find_package(PkgConfig) -pkg_check_modules(POPPLER poppler>=0.23.0) + + +pkg_check_modules(POPPLER poppler>=0.25.0) if(POPPLER_FOUND) + set(POPPLER_OLDER_THAN_0_25_0 0) set(POPPLER_OLDER_THAN_0_23_0 0) else() - set(POPPLER_OLDER_THAN_0_23_0 1) - pkg_check_modules(POPPLER REQUIRED poppler>=0.20.0) + set(POPPLER_OLDER_THAN_0_25_0 1) + pkg_check_modules(POPPLER poppler>=0.23.0) + if(POPPLER_FOUND) + set(POPPLER_OLDER_THAN_0_23_0 0) + else() + set(POPPLER_OLDER_THAN_0_23_0 1) + pkg_check_modules(POPPLER REQUIRED poppler>=0.20.0) + endif() endif() + include_directories(${POPPLER_INCLUDE_DIRS}) link_directories(${POPPLER_LIBRARY_DIRS}) set(PDF2HTMLEX_LIBS ${PDF2HTMLEX_LIBS} ${POPPLER_LIBRARIES}) diff --git a/src/util/ffw.c b/src/util/ffw.c index aab9c2d..200d714 100644 --- a/src/util/ffw.c +++ b/src/util/ffw.c @@ -202,7 +202,7 @@ static void ffw_do_reencode(Encoding * encoding, int force) SFReplaceEncodingBDFProps(cur_fv->sf, cur_fv->map); free(cur_fv->selected); - cur_fv->selected = gcalloc(cur_fv->map->enccount, sizeof(char)); + cur_fv->selected = calloc(cur_fv->map->enccount, sizeof(char)); } void ffw_reencode_glyph_order(void) diff --git a/src/util/unicode.cc b/src/util/unicode.cc index 212e674..fae2971 100644 --- a/src/util/unicode.cc +++ b/src/util/unicode.cc @@ -118,8 +118,11 @@ Unicode unicode_from_font (CharCode code, GfxFont * font) // may be untranslated ligature if(cname) { +#if POPPLER_OLDER_THAN_0_25_0 Unicode ou = globalParams->mapNameToUnicode(cname); - +#else + Unicode ou = globalParams->mapNameToUnicodeText(cname); +#endif if(isLegalUnicode(ou)) return ou; }