diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/linuxbsd/os_linuxbsd.cpp | 15 | ||||
-rw-r--r-- | platform/linuxbsd/platform_config.h | 2 | ||||
-rw-r--r-- | platform/macos/platform_config.h | 2 | ||||
-rw-r--r-- | platform/windows/platform_config.h | 2 |
4 files changed, 18 insertions, 3 deletions
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp index 81cadea51f..e14e4fb52d 100644 --- a/platform/linuxbsd/os_linuxbsd.cpp +++ b/platform/linuxbsd/os_linuxbsd.cpp @@ -634,6 +634,8 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold, ERR_FAIL_V_MSG(String(), "Unable to load fontconfig, system font support is disabled."); } + bool allow_substitutes = (p_font_name.to_lower() == "sans-serif") || (p_font_name.to_lower() == "serif") || (p_font_name.to_lower() == "monospace") || (p_font_name.to_lower() == "cursive") || (p_font_name.to_lower() == "fantasy"); + String ret; FcConfig *config = FcInitLoadConfigAndFonts(); @@ -655,6 +657,19 @@ String OS_LinuxBSD::get_system_font_path(const String &p_font_name, bool p_bold, FcResult result; FcPattern *match = FcFontMatch(0, pattern, &result); if (match) { + if (!allow_substitutes) { + char *family_name = nullptr; + if (FcPatternGetString(match, FC_FAMILY, 0, reinterpret_cast<FcChar8 **>(&family_name)) == FcResultMatch) { + if (family_name && String::utf8(family_name).to_lower() != p_font_name.to_lower()) { + FcPatternDestroy(match); + FcPatternDestroy(pattern); + FcObjectSetDestroy(object_set); + FcConfigDestroy(config); + + return String(); + } + } + } char *file_name = nullptr; if (FcPatternGetString(match, FC_FILE, 0, reinterpret_cast<FcChar8 **>(&file_name)) == FcResultMatch) { if (file_name) { diff --git a/platform/linuxbsd/platform_config.h b/platform/linuxbsd/platform_config.h index 3c05c67444..79e15e2512 100644 --- a/platform/linuxbsd/platform_config.h +++ b/platform/linuxbsd/platform_config.h @@ -44,4 +44,4 @@ #endif #endif -#define OPENGL_INCLUDE_H "thirdparty/glad/glad/glad.h" +#define OPENGL_INCLUDE_H "thirdparty/glad/glad/gl.h" diff --git a/platform/macos/platform_config.h b/platform/macos/platform_config.h index e114606b82..46c46b8803 100644 --- a/platform/macos/platform_config.h +++ b/platform/macos/platform_config.h @@ -30,5 +30,5 @@ #include <alloca.h> -#define OPENGL_INCLUDE_H "thirdparty/glad/glad/glad.h" +#define OPENGL_INCLUDE_H "thirdparty/glad/glad/gl.h" #define PTHREAD_RENAME_SELF diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 8e80f8cacb..7f0042d76f 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -30,4 +30,4 @@ #include <malloc.h> -#define OPENGL_INCLUDE_H "thirdparty/glad/glad/glad.h" +#define OPENGL_INCLUDE_H "thirdparty/glad/glad/gl.h" |