diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-28 20:37:58 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-08-28 20:37:58 +0200 |
commit | ba1089689af0f77b501b2b8915808e4540b7c6a2 (patch) | |
tree | 9ad59c2ba91d3c5d8a04c2d6ae1a754fba72a1c7 /servers | |
parent | 22b7fcabc689149fdba09325a9e9ff1939d83373 (diff) | |
parent | 545350369774ffb56d207f22102c0b9c58035192 (diff) | |
download | redot-engine-ba1089689af0f77b501b2b8915808e4540b7c6a2.tar.gz |
Merge pull request #80954 from bruvzg/sp_per_font
[Text Server] Store extra spacing of individual font variations.
Diffstat (limited to 'servers')
-rw-r--r-- | servers/text/text_server_extension.cpp | 13 | ||||
-rw-r--r-- | servers/text/text_server_extension.h | 5 | ||||
-rw-r--r-- | servers/text_server.cpp | 3 | ||||
-rw-r--r-- | servers/text_server.h | 3 |
4 files changed, 24 insertions, 0 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 6fc13867cc..91a2c9797e 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -109,6 +109,9 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_font_set_embolden, "font_rid", "strength"); GDVIRTUAL_BIND(_font_get_embolden, "font_rid"); + GDVIRTUAL_BIND(_font_set_spacing, "font_rid", "spacing", "value"); + GDVIRTUAL_BIND(_font_get_spacing, "font_rid", "spacing"); + GDVIRTUAL_BIND(_font_set_transform, "font_rid", "transform"); GDVIRTUAL_BIND(_font_get_transform, "font_rid"); @@ -599,6 +602,16 @@ double TextServerExtension::font_get_embolden(const RID &p_font_rid) const { return ret; } +void TextServerExtension::font_set_spacing(const RID &p_font_rid, SpacingType p_spacing, int64_t p_value) { + GDVIRTUAL_CALL(_font_set_spacing, p_font_rid, p_spacing, p_value); +} + +int64_t TextServerExtension::font_get_spacing(const RID &p_font_rid, SpacingType p_spacing) const { + int64_t ret = 0; + GDVIRTUAL_CALL(_font_get_spacing, p_font_rid, p_spacing, ret); + return ret; +} + void TextServerExtension::font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) { GDVIRTUAL_CALL(_font_set_transform, p_font_rid, p_transform); } diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index a0c47a70d6..1d475f13d4 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -161,6 +161,11 @@ public: GDVIRTUAL2(_font_set_embolden, RID, double); GDVIRTUAL1RC(double, _font_get_embolden, RID); + virtual void font_set_spacing(const RID &p_font_rid, SpacingType p_spacing, int64_t p_value) override; + virtual int64_t font_get_spacing(const RID &p_font_rid, SpacingType p_spacing) const override; + GDVIRTUAL3(_font_set_spacing, const RID &, SpacingType, int64_t); + GDVIRTUAL2RC(int64_t, _font_get_spacing, const RID &, SpacingType); + virtual void font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) override; virtual Transform2D font_get_transform(const RID &p_font_rid) const override; GDVIRTUAL2(_font_set_transform, RID, Transform2D); diff --git a/servers/text_server.cpp b/servers/text_server.cpp index 28c6b20f7b..3c901f573e 100644 --- a/servers/text_server.cpp +++ b/servers/text_server.cpp @@ -263,6 +263,9 @@ void TextServer::_bind_methods() { ClassDB::bind_method(D_METHOD("font_set_embolden", "font_rid", "strength"), &TextServer::font_set_embolden); ClassDB::bind_method(D_METHOD("font_get_embolden", "font_rid"), &TextServer::font_get_embolden); + ClassDB::bind_method(D_METHOD("font_set_spacing", "font_rid", "spacing", "value"), &TextServer::font_set_spacing); + ClassDB::bind_method(D_METHOD("font_get_spacing", "font_rid", "spacing"), &TextServer::font_get_spacing); + ClassDB::bind_method(D_METHOD("font_set_transform", "font_rid", "transform"), &TextServer::font_set_transform); ClassDB::bind_method(D_METHOD("font_get_transform", "font_rid"), &TextServer::font_get_transform); diff --git a/servers/text_server.h b/servers/text_server.h index 7bc353cb8c..d0cfd87b64 100644 --- a/servers/text_server.h +++ b/servers/text_server.h @@ -295,6 +295,9 @@ public: virtual void font_set_embolden(const RID &p_font_rid, double p_strength) = 0; virtual double font_get_embolden(const RID &p_font_rid) const = 0; + virtual void font_set_spacing(const RID &p_font_rid, SpacingType p_spacing, int64_t p_value) = 0; + virtual int64_t font_get_spacing(const RID &p_font_rid, SpacingType p_spacing) const = 0; + virtual void font_set_transform(const RID &p_font_rid, const Transform2D &p_transform) = 0; virtual Transform2D font_get_transform(const RID &p_font_rid) const = 0; |