Use fontconfig for linux/mac
This uses fontconfig for looking up font files for freetype to use on both linux and mac. It's apparently a bit more optimal and prevents us from having to worry about the load time on the mac version as well. Refactored and moved all the old code to the find-font-windows.c file, as it's no longer used on anything but windows.
This commit is contained in:
39
cmake/Modules/FindFontconfig.cmake
Normal file
39
cmake/Modules/FindFontconfig.cmake
Normal file
@@ -0,0 +1,39 @@
|
||||
# Once done these will be defined:
|
||||
#
|
||||
# FONTCONFIG_FOUND
|
||||
# FONTCONFIG_INCLUDE_DIRS
|
||||
# FONTCONFIG_LIBRARIES
|
||||
#
|
||||
|
||||
if(FONTCONFIG_INCLUDE_DIRS AND FONTCONFIG_LIBRARIES)
|
||||
set(FONTCONFIG_FOUND TRUE)
|
||||
else()
|
||||
find_package(PkgConfig QUIET)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(_FONTCONFIG QUIET fontconfig)
|
||||
endif()
|
||||
|
||||
find_path(FONTCONFIG_INCLUDE_DIR
|
||||
NAMES fontconfig/fontconfig.h
|
||||
HINTS
|
||||
${_FONTCONFIG_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include /usr/local/include /opt/local/include)
|
||||
|
||||
find_library(FONTCONFIG_LIB
|
||||
NAMES fontconfig
|
||||
HINTS
|
||||
${_FONTCONFIG_LIBRARY_DIRS}
|
||||
PATHS
|
||||
/usr/lib /usr/local/lib /opt/local/lib)
|
||||
|
||||
set(FONTCONFIG_INCLUDE_DIRS ${FONTCONFIG_INCLUDE_DIR}
|
||||
CACHE PATH "fontconfig include dir")
|
||||
set(FONTCONFIG_LIBRARIES "${FONTCONFIG_LIB}"
|
||||
CACHE STRING "fontconfig libraries")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Fontconfig DEFAULT_MSG FONTCONFIG_LIB
|
||||
FONTCONFIG_INCLUDE_DIR)
|
||||
mark_as_advanced(FONTCONFIG_INCLUDE_DIR FONTCONFIG_LIB)
|
||||
endif()
|
Reference in New Issue
Block a user