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/macos/os_macos.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'platform/macos/os_macos.h') diff --git a/platform/macos/os_macos.h b/platform/macos/os_macos.h index 46e7c17ebe..b2734e57cc 100644 --- a/platform/macos/os_macos.h +++ b/platform/macos/os_macos.h @@ -57,6 +57,10 @@ class OS_MacOS : public OS_Unix { List launch_service_args; + CGFloat _weight_to_ct(int p_weight) const; + CGFloat _stretch_to_ct(int p_stretch) const; + String _get_default_fontname(const String &p_font_name) const; + static _FORCE_INLINE_ String get_framework_executable(const String &p_path); static void pre_wait_observer_cb(CFRunLoopObserverRef p_observer, CFRunLoopActivity p_activiy, void *p_context); @@ -98,7 +102,8 @@ public: virtual String get_locale() 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_executable_path() const override; virtual Error create_process(const String &p_path, const List &p_arguments, ProcessID *r_child_id = nullptr, bool p_open_console = false) override; virtual Error create_instance(const List &p_arguments, ProcessID *r_child_id = nullptr) override; -- cgit v1.2.3