From 60d60909400c232f5903cc6b428da83eab5574ed Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sun, 16 Sep 2012 13:55:13 +0800 Subject: [PATCH] fix including config.h for fontforge --- CMakeLists.txt | 22 ++++++++++++---------- TODO | 2 -- src/ff.c | 1 + 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33285cc..f6bd9fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,8 @@ else() find_path(FF_INCLUDE_PATH fontforge/fontforge.h) if(FF_INCLUDE_PATH) message("Found fontforge.h: ${FF_INCLUDE_PATH}/fontforge/fontforge.h") - include_directories(${FF_INCLUDE_PATH}/fontforge) + set(FONTFORGE_INCLUDE_DIRS ${FF_INCLUDE_PATH}/fontforge) + include_directories(${FONTFORGE_INCLUDE_DIRS}) # MacOSX gettext is in /opt/local/include - strange if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") find_path(GETTEXT_INCLUDE_PATH libintl.h) @@ -32,11 +33,6 @@ else() message(FATAL_ERROR "Error: cannot locate fontforge.h") endif() - find_path(FF_CONFIG_INCLUDE_PATH fontforge/config.h) - if(FF_CONFIG_INCLUDE_PATH) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${FF_INCLUDE_PATH}/fontforge/config.h") - endif() - foreach(FF_LIB_NAME ${CMAKE_IMPORT_LIBRARY_PREFIX}fontforge${CMAKE_IMPORT_LIBRARY_SUFFIX} ${CMAKE_SHARED_LIBRARY_PREFIX}fontforge${CMAKE_SHARED_LIBRARY_SUFFIX} @@ -58,6 +54,12 @@ else() message("Looking for libraries of python, which is required by fontforge, if you can link fontforge without python, you may disable this") pkg_search_module(PYTHON python python-2.7) endif() +find_path(FF_CONFIG_INCLUDE_PATH config.h PATHS ${FONTFORGE_INCLUDE_DIRS}) +if(FF_CONFIG_INCLUDE_PATH) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -include ${FF_CONFIG_INCLUDE_PATH}/config.h") +else() + message("Cannot locate config.h for fontforge") +endif() @@ -69,16 +71,16 @@ add_custom_target(dist WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused-function") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") -#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb") +#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wunused-function") # clang compiler need c++11 flag if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") # CYGWIN bug if(CYGWIN) diff --git a/TODO b/TODO index 222308e..b105054 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ -change typo asc/desc, without affecting EM size - rename single-html -> embed-font/image/css ... bug found in baidu & github & mail diff --git a/src/ff.c b/src/ff.c index fb017d7..c45a0c1 100644 --- a/src/ff.c +++ b/src/ff.c @@ -89,6 +89,7 @@ void ff_load_font(const char * filename) { char * _filename = strcopy(filename); SplineFont * font = LoadSplineFont(_filename, 1); + free(_filename); if(!font)