From ecec415988de5b016c70512bbb6a7cfc04ccd0a2 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 21 Nov 2022 15:04:01 +0200 Subject: Use system fonts as fallback and improve system font handling. Add support for font weight and stretch selection when using system fonts. Add function to get system fallback font from a font name, style, text, and language code. Implement system font support for Android. Use system fonts as a last resort fallback. --- platform/linuxbsd/os_linuxbsd.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'platform/linuxbsd/os_linuxbsd.h') diff --git a/platform/linuxbsd/os_linuxbsd.h b/platform/linuxbsd/os_linuxbsd.h index aa7af92aa1..ef830a069b 100644 --- a/platform/linuxbsd/os_linuxbsd.h +++ b/platform/linuxbsd/os_linuxbsd.h @@ -40,11 +40,17 @@ #include "joypad_linux.h" #include "servers/audio_server.h" +#ifdef FONTCONFIG_ENABLED +#include "fontconfig-so_wrap.h" +#endif + class OS_LinuxBSD : public OS_Unix { virtual void delete_main_loop() override; #ifdef FONTCONFIG_ENABLED bool font_config_initialized = false; + FcConfig *config = nullptr; + FcObjectSet *object_set = nullptr; #endif #ifdef JOYDEV_ENABLED @@ -67,6 +73,9 @@ class OS_LinuxBSD : public OS_Unix { MainLoop *main_loop = nullptr; + int _weight_to_fc(int p_weight) const; + int _stretch_to_fc(int p_stretch) const; + String get_systemd_os_release_info_value(const String &key) const; Vector lspci_device_filter(Vector vendor_device_id_mapping, String class_suffix, String check_column, String whitelist) const; @@ -94,7 +103,8 @@ public: virtual uint64_t get_embedded_pck_offset() const override; virtual Vector get_system_fonts() const override; - virtual String get_system_font_path(const String &p_font_name, bool p_bold = false, bool p_italic = false) const override; + virtual String get_system_font_path(const String &p_font_name, int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; + virtual Vector get_system_font_path_for_text(const String &p_font_name, const String &p_text, const String &p_locale = String(), const String &p_script = String(), int p_weight = 400, int p_stretch = 100, bool p_italic = false) const override; virtual String get_config_path() const override; virtual String get_data_path() const override; @@ -119,6 +129,7 @@ public: virtual Error move_to_trash(const String &p_path) override; OS_LinuxBSD(); + ~OS_LinuxBSD(); }; #endif // OS_LINUXBSD_H -- cgit v1.2.3