From c89c515ccf941a62bf2ec501095fad57d72cb1f7 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Thu, 18 Nov 2021 23:36:22 +0200 Subject: [TextServer] Improve ligature cursor handling. Fix mid-grapheme hit test. Fix OpenType features property handling, add default features override option. Enable mid-grapheme cursor by default. --- servers/text/text_server_extension.cpp | 15 +++++++++++++++ servers/text/text_server_extension.h | 5 +++++ 2 files changed, 20 insertions(+) (limited to 'servers/text') diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 2b0510680e..a51b62e730 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -174,6 +174,9 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_font_remove_script_support_override, "font_rid", "script"); GDVIRTUAL_BIND(_font_get_script_support_overrides, "font_rid"); + GDVIRTUAL_BIND(_font_set_opentype_feature_overrides, "font_rid", "overrides"); + GDVIRTUAL_BIND(_font_get_opentype_feature_overrides, "font_rid"); + GDVIRTUAL_BIND(_font_supported_feature_list, "font_rid"); GDVIRTUAL_BIND(_font_supported_variation_list, "font_rid"); @@ -869,6 +872,18 @@ Vector TextServerExtension::font_get_script_support_overrides(RID p_font return Vector(); } +void TextServerExtension::font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) { + GDVIRTUAL_CALL(_font_set_opentype_feature_overrides, p_font_rid, p_overrides); +} + +Dictionary TextServerExtension::font_get_opentype_feature_overrides(RID p_font_rid) const { + Dictionary ret; + if (GDVIRTUAL_CALL(_font_get_opentype_feature_overrides, p_font_rid, ret)) { + return ret; + } + return Dictionary(); +} + Dictionary TextServerExtension::font_supported_feature_list(RID p_font_rid) const { Dictionary ret; if (GDVIRTUAL_CALL(_font_supported_feature_list, p_font_rid, ret)) { diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index 5c97401118..9b456c2dd7 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -285,6 +285,11 @@ public: GDVIRTUAL2(_font_remove_script_support_override, RID, const String &); GDVIRTUAL1R(Vector, _font_get_script_support_overrides, RID); + virtual void font_set_opentype_feature_overrides(RID p_font_rid, const Dictionary &p_overrides) override; + virtual Dictionary font_get_opentype_feature_overrides(RID p_font_rid) const override; + GDVIRTUAL2(_font_set_opentype_feature_overrides, RID, const Dictionary &); + GDVIRTUAL1RC(Dictionary, _font_get_opentype_feature_overrides, RID); + virtual Dictionary font_supported_feature_list(RID p_font_rid) const override; virtual Dictionary font_supported_variation_list(RID p_font_rid) const override; GDVIRTUAL1RC(Dictionary, _font_supported_feature_list, RID); -- cgit v1.2.3