diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-10-26 09:40:11 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-10-31 12:40:58 +0200 |
commit | 3f33e1d7d6d07620487758c7a850ec40ce3aafdf (patch) | |
tree | a7bbd736023908784df03abc829ba3f1e58831be /servers/text | |
parent | d6f972fad45d28222b1437a047241dd74f0d5b90 (diff) |
Add functions for getting name and font style from dynamic and bitmap fonts.
Add font selection toolbar editor plugin.
Diffstat (limited to 'servers/text')
-rw-r--r-- | servers/text/text_server_extension.cpp | 45 | ||||
-rw-r--r-- | servers/text/text_server_extension.h | 15 |
2 files changed, 60 insertions, 0 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index a44fee7c95..a830b8353a 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -55,6 +55,15 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_font_set_data, "font_rid", "data"); GDVIRTUAL_BIND(_font_set_data_ptr, "font_rid", "data_ptr", "data_size"); + GDVIRTUAL_BIND(_font_set_style, "font_rid", "style"); + GDVIRTUAL_BIND(_font_get_style, "font_rid"); + + GDVIRTUAL_BIND(_font_set_name, "font_rid", "name"); + GDVIRTUAL_BIND(_font_get_name, "font_rid"); + + GDVIRTUAL_BIND(_font_set_style_name, "font_rid", "name_style"); + GDVIRTUAL_BIND(_font_get_style_name, "font_rid"); + GDVIRTUAL_BIND(_font_set_antialiased, "font_rid", "antialiased"); GDVIRTUAL_BIND(_font_is_antialiased, "font_rid"); @@ -368,6 +377,42 @@ void TextServerExtension::font_set_data_ptr(RID p_font_rid, const uint8_t *p_dat GDVIRTUAL_CALL(_font_set_data_ptr, p_font_rid, p_data_ptr, p_data_size); } +void TextServerExtension::font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) { + GDVIRTUAL_CALL(_font_set_style, p_font_rid, p_style); +} + +uint32_t /*FontStyle*/ TextServerExtension::font_get_style(RID p_font_rid) const { + uint32_t ret; + if (GDVIRTUAL_CALL(_font_get_style, p_font_rid, ret)) { + return ret; + } + return 0; +} + +void TextServerExtension::font_set_style_name(RID p_font_rid, const String &p_name) { + GDVIRTUAL_CALL(_font_set_style_name, p_font_rid, p_name); +} + +String TextServerExtension::font_get_style_name(RID p_font_rid) const { + String ret; + if (GDVIRTUAL_CALL(_font_get_style_name, p_font_rid, ret)) { + return ret; + } + return String(); +} + +void TextServerExtension::font_set_name(RID p_font_rid, const String &p_name) { + GDVIRTUAL_CALL(_font_set_name, p_font_rid, p_name); +} + +String TextServerExtension::font_get_name(RID p_font_rid) const { + String ret; + if (GDVIRTUAL_CALL(_font_get_name, p_font_rid, ret)) { + return ret; + } + return String(); +} + void TextServerExtension::font_set_antialiased(RID p_font_rid, bool p_antialiased) { GDVIRTUAL_CALL(_font_set_antialiased, p_font_rid, p_antialiased); } diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index 954b2cf660..fd3bb45eaf 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -84,6 +84,21 @@ public: GDVIRTUAL2(_font_set_data, RID, const PackedByteArray &); GDVIRTUAL3(_font_set_data_ptr, RID, GDNativeConstPtr<const uint8_t>, uint64_t); + virtual void font_set_style(RID p_font_rid, uint32_t /*FontStyle*/ p_style) override; + virtual uint32_t /*FontStyle*/ font_get_style(RID p_font_rid) const override; + GDVIRTUAL2(_font_set_style, RID, uint32_t); + GDVIRTUAL1RC(uint32_t, _font_get_style, RID); + + virtual void font_set_name(RID p_font_rid, const String &p_name) override; + virtual String font_get_name(RID p_font_rid) const override; + GDVIRTUAL2(_font_set_name, RID, const String &); + GDVIRTUAL1RC(String, _font_get_name, RID); + + virtual void font_set_style_name(RID p_font_rid, const String &p_name) override; + virtual String font_get_style_name(RID p_font_rid) const override; + GDVIRTUAL2(_font_set_style_name, RID, const String &); + GDVIRTUAL1RC(String, _font_get_style_name, RID); + virtual void font_set_antialiased(RID p_font_rid, bool p_antialiased) override; virtual bool font_is_antialiased(RID p_font_rid) const override; GDVIRTUAL2(_font_set_antialiased, RID, bool); |