mirror of
https://github.com/glfw/glfw.git
synced 2025-06-14 19:52:14 +00:00
tests: Fix branching of using fontconfig
fontconfig seems to have a problem with macOS, so limit to X11 or Wayland.
This commit is contained in:
parent
a7ec734281
commit
6f85a43e78
@ -49,9 +49,13 @@ if (RT_LIBRARY)
|
|||||||
target_link_libraries(empty "${RT_LIBRARY}")
|
target_link_libraries(empty "${RT_LIBRARY}")
|
||||||
target_link_libraries(threads "${RT_LIBRARY}")
|
target_link_libraries(threads "${RT_LIBRARY}")
|
||||||
endif()
|
endif()
|
||||||
if (NOT WIN32)
|
|
||||||
find_package(Fontconfig REQUIRED)
|
if (GLFW_BUILD_X11 OR GLFW_BUILD_WAYLAND)
|
||||||
target_link_libraries(input_text fontconfig)
|
find_package(Fontconfig)
|
||||||
|
if (FONTCONFIG_FOUND)
|
||||||
|
target_compile_definitions(input_text PRIVATE FONTCONFIG_ENABLED)
|
||||||
|
target_link_libraries(input_text fontconfig)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(GUI_ONLY_BINARIES empty gamma icon input_text inputlag joysticks tearing
|
set(GUI_ONLY_BINARIES empty gamma icon input_text inputlag joysticks tearing
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
//
|
//
|
||||||
// Currently, it is made for Japanese input only.
|
// Currently, it is made for Japanese input only.
|
||||||
// You have to select the correct font to display Japanese texts.
|
// You have to select the correct font to display Japanese texts.
|
||||||
// You can set TTF_FONT_FILEPATH to set default font or you can choose a font by GUI in UNIX-like OS.
|
// You can set TTF_FONT_FILEPATH to set default font or you can choose a font by GUI
|
||||||
|
// if fontconfig libary is enabled in X11 or Wayland.
|
||||||
//
|
//
|
||||||
// To handle other languages, you need to add correct ranges to nk_font_config.
|
// To handle other languages, you need to add correct ranges to nk_font_config.
|
||||||
//
|
//
|
||||||
@ -69,7 +70,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#if !defined(_GLFW_WIN32)
|
#if defined(FONTCONFIG_ENABLED)
|
||||||
#include <fontconfig/fontconfig.h>
|
#include <fontconfig/fontconfig.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -98,7 +99,7 @@ static char** fontFilePaths;
|
|||||||
static int fontNum = 0;
|
static int fontNum = 0;
|
||||||
static int currentFontIndex = 0;
|
static int currentFontIndex = 0;
|
||||||
|
|
||||||
#if (defined(_GLFW_WIN32) || defined(TTF_FONT_FILEPATH))
|
#if (!defined(FONTCONFIG_ENABLED) || defined(TTF_FONT_FILEPATH))
|
||||||
static void init_font_list()
|
static void init_font_list()
|
||||||
{
|
{
|
||||||
fontFamilyNames = (char**) malloc(sizeof(char*) * MAX_FONTS_LEN);
|
fontFamilyNames = (char**) malloc(sizeof(char*) * MAX_FONTS_LEN);
|
||||||
@ -207,7 +208,7 @@ static void init_font_list()
|
|||||||
|
|
||||||
static void deinit_font_list()
|
static void deinit_font_list()
|
||||||
{
|
{
|
||||||
#if !(defined(_GLFW_WIN32) || defined(TTF_FONT_FILEPATH))
|
#if !(!defined(FONTCONFIG_ENABLED) || defined(TTF_FONT_FILEPATH))
|
||||||
for (int i = 1; i < fontNum; ++i)
|
for (int i = 1; i < fontNum; ++i)
|
||||||
{
|
{
|
||||||
free(fontFamilyNames[i]);
|
free(fontFamilyNames[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user