From 29199579f780f4f66350e1962926c08b2ddcf65b Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 10 Jan 2022 10:13:22 +0200 Subject: Add sub-pixel glyph positioning support. --- 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 3c5faa4ef7..5792572dc1 100644 --- a/servers/text/text_server_extension.cpp +++ b/servers/text/text_server_extension.cpp @@ -85,6 +85,9 @@ void TextServerExtension::_bind_methods() { GDVIRTUAL_BIND(_font_set_hinting, "font_rid", "hinting"); GDVIRTUAL_BIND(_font_get_hinting, "font_rid"); + GDVIRTUAL_BIND(_font_set_subpixel_positioning, "font_rid", "subpixel_positioning"); + GDVIRTUAL_BIND(_font_get_subpixel_positioning, "font_rid"); + GDVIRTUAL_BIND(_font_set_variation_coordinates, "font_rid", "variation_coordinates"); GDVIRTUAL_BIND(_font_get_variation_coordinates, "font_rid"); @@ -512,6 +515,18 @@ TextServer::Hinting TextServerExtension::font_get_hinting(RID p_font_rid) const return TextServer::Hinting::HINTING_NONE; } +void TextServerExtension::font_set_subpixel_positioning(RID p_font_rid, TextServer::SubpixelPositioning p_subpixel) { + GDVIRTUAL_CALL(_font_set_subpixel_positioning, p_font_rid, p_subpixel); +} + +TextServer::SubpixelPositioning TextServerExtension::font_get_subpixel_positioning(RID p_font_rid) const { + TextServer::SubpixelPositioning ret; + if (GDVIRTUAL_CALL(_font_get_subpixel_positioning, p_font_rid, ret)) { + return (TextServer::SubpixelPositioning)ret; + } + return TextServer::SubpixelPositioning::SUBPIXEL_POSITIONING_DISABLED; +} + 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 9e7f666be1..d185e44806 100644 --- a/servers/text/text_server_extension.h +++ b/servers/text/text_server_extension.h @@ -134,6 +134,11 @@ public: GDVIRTUAL2(_font_set_hinting, RID, Hinting); GDVIRTUAL1RC(Hinting, _font_get_hinting, RID); + virtual void font_set_subpixel_positioning(RID p_font_rid, SubpixelPositioning p_subpixel) override; + virtual SubpixelPositioning font_get_subpixel_positioning(RID p_font_rid) const override; + GDVIRTUAL2(_font_set_subpixel_positioning, RID, SubpixelPositioning); + GDVIRTUAL1RC(SubpixelPositioning, _font_get_subpixel_positioning, 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); -- cgit v1.2.3