summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2020-10-22 19:40:18 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2020-12-13 18:43:39 +0200
commitc1d261fdb09db3aae4c7fa6587812a697f2ea8cd (patch)
tree20f75fac2110d3466e759d51518b5202506490ff /servers
parentbbf7bb383810f397760961cb1666860f9b0791b8 (diff)
[Complex Text Layouts] Add variable fonts support.
Diffstat (limited to 'servers')
-rw-r--r--servers/text_server.cpp5
-rw-r--r--servers/text_server.h7
2 files changed, 11 insertions, 1 deletions
diff --git a/servers/text_server.cpp b/servers/text_server.cpp
index 23bcefa80d..b2584d9ffd 100644
--- a/servers/text_server.cpp
+++ b/servers/text_server.cpp
@@ -231,6 +231,10 @@ void TextServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("font_get_antialiased", "font"), &TextServer::font_get_antialiased);
ClassDB::bind_method(D_METHOD("font_get_feature_list", "font"), &TextServer::font_get_feature_list);
+ ClassDB::bind_method(D_METHOD("font_get_variation_list", "font"), &TextServer::font_get_variation_list);
+
+ ClassDB::bind_method(D_METHOD("font_set_variation", "font", "tag", "value"), &TextServer::font_set_variation);
+ ClassDB::bind_method(D_METHOD("font_get_variation", "font", "tag"), &TextServer::font_get_variation);
ClassDB::bind_method(D_METHOD("font_set_hinting", "font", "hinting"), &TextServer::font_set_hinting);
ClassDB::bind_method(D_METHOD("font_get_hinting", "font"), &TextServer::font_get_hinting);
@@ -385,6 +389,7 @@ void TextServer::_bind_methods() {
BIND_ENUM_CONSTANT(FEATURE_KASHIDA_JUSTIFICATION);
BIND_ENUM_CONSTANT(FEATURE_BREAK_ITERATORS);
BIND_ENUM_CONSTANT(FEATURE_FONT_SYSTEM);
+ BIND_ENUM_CONSTANT(FEATURE_FONT_VARIABLE);
BIND_ENUM_CONSTANT(FEATURE_USE_SUPPORT_DATA);
}
diff --git a/servers/text_server.h b/servers/text_server.h
index 6796b7f1d6..09179cd218 100644
--- a/servers/text_server.h
+++ b/servers/text_server.h
@@ -94,7 +94,8 @@ public:
FEATURE_KASHIDA_JUSTIFICATION = 1 << 3,
FEATURE_BREAK_ITERATORS = 1 << 4,
FEATURE_FONT_SYSTEM = 1 << 5,
- FEATURE_USE_SUPPORT_DATA = 1 << 6
+ FEATURE_FONT_VARIABLE = 1 << 6,
+ FEATURE_USE_SUPPORT_DATA = 1 << 7
};
struct Glyph {
@@ -246,6 +247,10 @@ public:
virtual bool font_get_antialiased(RID p_font) const = 0;
virtual Dictionary font_get_feature_list(RID p_font) const { return Dictionary(); };
+ virtual Dictionary font_get_variation_list(RID p_font) const { return Dictionary(); };
+
+ virtual void font_set_variation(RID p_font, const String &p_name, double p_value){};
+ virtual double font_get_variation(RID p_font, const String &p_name) const { return 0; };
virtual void font_set_distance_field_hint(RID p_font, bool p_distance_field) = 0;
virtual bool font_get_distance_field_hint(RID p_font) const = 0;