diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-03-11 09:31:16 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-03-11 14:02:30 +0200 |
commit | b32e8d63d8d3bfe65f6692ff15f5a82171a8bf61 (patch) | |
tree | 7a6e7a945a25a8e954e81b9e409f80188db4f2c9 /servers/text | |
parent | 1e099afc8ac420f5c97b07067e28d6309ed55ae7 (diff) |
Add options to embolden and transform font outlines to simulate bold and italic typefaces.
Diffstat (limited to 'servers/text')
-rw-r--r-- | servers/text/text_server_extension.cpp | 30 | ||||
-rw-r--r-- | servers/text/text_server_extension.h | 10 |
2 files changed, 40 insertions, 0 deletions
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp index 5792572dc1..1a10161a5b 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -88,6 +88,12 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_font_set_subpixel_positioning, "font_rid", "subpixel_positioning"); GDVIRTUAL_BIND(_font_get_subpixel_positioning, "font_rid"); + GDVIRTUAL_BIND(_font_set_embolden, "font_rid", "strength"); + GDVIRTUAL_BIND(_font_get_embolden, "font_rid"); + + GDVIRTUAL_BIND(_font_set_transform, "font_rid", "transform"); + GDVIRTUAL_BIND(_font_get_transform, "font_rid"); + GDVIRTUAL_BIND(_font_set_variation_coordinates, "font_rid", "variation_coordinates"); GDVIRTUAL_BIND(_font_get_variation_coordinates, "font_rid"); @@ -527,6 +533,30 @@ TextServer::SubpixelPositioning TextServerExtension::font_get_subpixel_positioni return TextServer::SubpixelPositioning::SUBPIXEL_POSITIONING_DISABLED; } +void TextServerExtension::font_set_embolden(RID p_font_rid, float p_strength) { + GDVIRTUAL_CALL(_font_set_embolden, p_font_rid, p_strength); +} + +float TextServerExtension::font_get_embolden(RID p_font_rid) const { + float ret; + if (GDVIRTUAL_CALL(_font_get_embolden, p_font_rid, ret)) { + return ret; + } + return 0.f; +} + +void TextServerExtension::font_set_transform(RID p_font_rid, Transform2D p_transform) { + GDVIRTUAL_CALL(_font_set_transform, p_font_rid, p_transform); +} + +Transform2D TextServerExtension::font_get_transform(RID p_font_rid) const { + Transform2D ret; + if (GDVIRTUAL_CALL(_font_get_transform, p_font_rid, ret)) { + return ret; + } + return Transform2D(); +} + void TextServerExtension::font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) { GDVIRTUAL_CALL(_font_set_variation_coordinates, p_font_rid, p_variation_coordinates); } diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h index d185e44806..7d80467371 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -139,6 +139,16 @@ public: GDVIRTUAL2(_font_set_subpixel_positioning, RID, SubpixelPositioning); GDVIRTUAL1RC(SubpixelPositioning, _font_get_subpixel_positioning, RID); + virtual void font_set_embolden(RID p_font_rid, float p_strength) override; + virtual float font_get_embolden(RID p_font_rid) const override; + GDVIRTUAL2(_font_set_embolden, RID, float); + GDVIRTUAL1RC(float, _font_get_embolden, RID); + + virtual void font_set_transform(RID p_font_rid, Transform2D p_transform) override; + virtual Transform2D font_get_transform(RID p_font_rid) const override; + GDVIRTUAL2(_font_set_transform, RID, Transform2D); + GDVIRTUAL1RC(Transform2D, _font_get_transform, RID); + virtual void font_set_variation_coordinates(RID p_font_rid, const Dictionary &p_variation_coordinates) override; virtual Dictionary font_get_variation_coordinates(RID p_font_rid) const override; GDVIRTUAL2(_font_set_variation_coordinates, RID, Dictionary); |