diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 1361e1a85b..a0cfe8c541 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -420,8 +420,9 @@ if(wxUSE_GUI) if(wxUSE_PRIVATE_FONTS AND WXGTK) find_package(Fontconfig) - if(NOT FONTCONFIG_FOUND) - message(WARNING "Fontconfig not found, Private fonts won't be available") + find_package(PangoFT2) + if(NOT FONTCONFIG_FOUND OR NOT PANGOFT2_FOUND) + message(WARNING "Fontconfig or PangoFT2 not found, Private fonts won't be available") wx_option_force_value(wxUSE_PRIVATE_FONTS OFF) endif() endif() diff --git a/build/cmake/lib/core/CMakeLists.txt b/build/cmake/lib/core/CMakeLists.txt index 825fc081f3..d8125aa255 100644 --- a/build/cmake/lib/core/CMakeLists.txt +++ b/build/cmake/lib/core/CMakeLists.txt @@ -77,8 +77,8 @@ if(WXOSX_COCOA) endif() endif() if(WXGTK AND wxUSE_PRIVATE_FONTS) - wx_lib_include_directories(core PUBLIC ${FONTCONFIG_INCLUDE_DIR}) - wx_lib_link_libraries(core PUBLIC ${FONTCONFIG_LIBRARIES}) + wx_lib_include_directories(core PUBLIC ${FONTCONFIG_INCLUDE_DIRS} ${PANGOFT2_INCLUDE_DIRS}) + wx_lib_link_libraries(core PUBLIC ${FONTCONFIG_LIBRARIES} ${PANGOFT2_LIBRARIES}) endif() if(wxUSE_LIBSDL) if(SDL2_FOUND) diff --git a/build/cmake/modules/FindFontconfig.cmake b/build/cmake/modules/FindFontconfig.cmake index c7796b1643..43f04914a9 100644 --- a/build/cmake/modules/FindFontconfig.cmake +++ b/build/cmake/modules/FindFontconfig.cmake @@ -1,69 +1,30 @@ -# - Try to find the Fontconfig +# - Try to find Fontconfig # Once done this will define # # FONTCONFIG_FOUND - system has Fontconfig -# FONTCONFIG_INCLUDE_DIR - The include directory to use for the fontconfig headers -# FONTCONFIG_LIBRARIES - Link these to use FONTCONFIG -# FONTCONFIG_DEFINITIONS - Compiler switches required for using FONTCONFIG +# FONTCONFIG_INCLUDE_DIRS - The include directory to use for the Fontconfig headers +# FONTCONFIG_LIBRARIES - Link these to use Fontconfig -# Copyright (c) 2006,2007 Laurent Montel, -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# +find_package(PkgConfig) +pkg_check_modules(PC_FONTCONFIG QUIET fontconfig) -if (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) +find_path(FONTCONFIG_INCLUDE_DIRS + NAMES fontconfig.h + HINTS ${PC_FONTCONFIG_INCLUDEDIR} + ${PC_FONTCONFIG_INCLUDE_DIRS} + PATH_SUFFIXES fontconfig +) - # in cache already - set(FONTCONFIG_FOUND TRUE) +find_library(FONTCONFIG_LIBRARIES + NAMES fontconfig + HINTS ${PC_FONTCONFIG_LIBDIR} + ${PC_FONTCONFIG_LIBRARY_DIRS} +) -else (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(FONTCONFIG DEFAULT_MSG FONTCONFIG_INCLUDE_DIRS FONTCONFIG_LIBRARIES) - if (NOT WIN32) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) - pkg_check_modules(PC_FONTCONFIG QUIET fontconfig) - - set(FONTCONFIG_DEFINITIONS ${PC_FONTCONFIG_CFLAGS_OTHER}) - endif (NOT WIN32) - - find_path(FONTCONFIG_INCLUDE_DIR fontconfig/fontconfig.h - PATHS - ${PC_FONTCONFIG_INCLUDEDIR} - ${PC_FONTCONFIG_INCLUDE_DIRS} - /usr/X11/include - ) - - find_library(FONTCONFIG_LIBRARIES NAMES fontconfig - PATHS - ${PC_FONTCONFIG_LIBDIR} - ${PC_FONTCONFIG_LIBRARY_DIRS} - ) - - include(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(Fontconfig DEFAULT_MSG FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR ) - - mark_as_advanced(FONTCONFIG_LIBRARIES FONTCONFIG_INCLUDE_DIR) - -endif (FONTCONFIG_LIBRARIES AND FONTCONFIG_INCLUDE_DIR) +mark_as_advanced( + FONTCONFIG_INCLUDE_DIRS + FONTCONFIG_LIBRARIES +) diff --git a/build/cmake/modules/FindPangoFT2.cmake b/build/cmake/modules/FindPangoFT2.cmake new file mode 100644 index 0000000000..8526b9aad5 --- /dev/null +++ b/build/cmake/modules/FindPangoFT2.cmake @@ -0,0 +1,30 @@ +# - Try to find PangoFT2 +# Once done this will define +# +# PANGOFT2_FOUND - system has PangoFT2 +# PANGOFT2_INCLUDE_DIRS - The include directory to use for the PangoFT2 headers +# PANGOFT2_LIBRARIES - Link these to use PangoFT2 + +find_package(PkgConfig) +pkg_check_modules(PC_PANGOFT2 QUIET pangoft2) + +find_path(PANGOFT2_INCLUDE_DIRS + NAMES pango-context.h + HINTS ${PC_PANGOFT2_INCLUDEDIR} + ${PC_PANGOFT2_INCLUDE_DIRS} + PATH_SUFFIXES pango +) + +find_library(PANGOFT2_LIBRARIES + NAMES pangoft2-1.0 + HINTS ${PC_PANGOFT2_LIBDIR} + ${PC_PANGOFT2_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PANGOFT2 REQUIRED_VARS PANGOFT2_INCLUDE_DIRS PANGOFT2_LIBRARIES) + +mark_as_advanced( + PANGOFT2_INCLUDE_DIRS + PANGOFT2_LIBRARIES +)