diff options
Diffstat (limited to 'platform/linuxbsd/os_linuxbsd.cpp')
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index bf4634a4fd..e306c1054b 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -53,7 +53,7 @@ #include <unistd.h> #ifdef FONTCONFIG_ENABLED -#include <fontconfig/fontconfig.h> +#include "fontconfig-so_wrap.h" #endif void OS_LinuxBSD::alert(const String &p_alert, const String &p_title) { @@ -333,6 +333,9 @@ uint64_t OS_LinuxBSD::get_embedded_pck_offset() const { Vector<String> OS_LinuxBSD::get_system_fonts() const { #ifdef FONTCONFIG_ENABLED + if (!font_config_initialized) { + ERR_FAIL_V_MSG(Vector<String>(), "Unable to load fontconfig, system font support is disabled."); + } HashSet<String> font_names; Vector<String> ret; @@ -371,12 +374,16 @@ Vector<String> OS_LinuxBSD::get_system_fonts() const { } return ret; #else - ERR_FAIL_COND_V_MSG(Vector<String>(), "Godot was compiled without fontconfig, system font support is disabled.") + ERR_FAIL_V_MSG(Vector<String>(), "Godot was compiled without fontconfig, system font support is disabled."); #endif } String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold, bool p_italic) const { #ifdef FONTCONFIG_ENABLED + if (!font_config_initialized) { + ERR_FAIL_V_MSG(String(), "Unable to load fontconfig, system font support is disabled."); + } + String ret; FcConfig *config = FcInitLoadConfigAndFonts(); @@ -410,10 +417,10 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold, FcPatternDestroy(pattern); } FcObjectSetDestroy(object_set); + return ret; #else - ERR_FAIL_COND_V_MSG(Vector<String>(), "Godot was compiled without fontconfig, system font support is disabled.") + ERR_FAIL_V_MSG(String(), "Godot was compiled without fontconfig, system font support is disabled."); #endif - return ret; } String OS_LinuxBSD::get_config_path() const { @@ -733,4 +740,13 @@ OS_LinuxBSD::OS_LinuxBSD() { #ifdef X11_ENABLED DisplayServerX11::register_x11_driver(); #endif + +#ifdef FONTCONFIG_ENABLED +#ifdef DEBUG_ENABLED + int dylibloader_verbose = 1; +#else + int dylibloader_verbose = 0; +#endif + font_config_initialized = (initialize_fontconfig(dylibloader_verbose) == 0); +#endif // FONTCONFIG_ENABLED } |