[TextServer] Reset subpixel shift on blank glyphs and import option to enable/disable it.

This commit is contained in:
bruvzg
2024-10-30 11:14:11 +02:00
parent c6c464cf9a
commit e81a2afbc4
18 changed files with 185 additions and 6 deletions

View File

@ -113,6 +113,9 @@ 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_keep_rounding_remainders, "font_rid", "keep_rounding_remainders");
GDVIRTUAL_BIND(_font_get_keep_rounding_remainders, "font_rid");
GDVIRTUAL_BIND(_font_set_embolden, "font_rid", "strength");
GDVIRTUAL_BIND(_font_get_embolden, "font_rid");
@ -640,6 +643,16 @@ TextServer::SubpixelPositioning TextServerExtension::font_get_subpixel_positioni
return ret;
}
void TextServerExtension::font_set_keep_rounding_remainders(const RID &p_font_rid, bool p_keep_rounding_remainders) {
GDVIRTUAL_CALL(_font_set_keep_rounding_remainders, p_font_rid, p_keep_rounding_remainders);
}
bool TextServerExtension::font_get_keep_rounding_remainders(const RID &p_font_rid) const {
bool ret = true;
GDVIRTUAL_CALL(_font_get_keep_rounding_remainders, p_font_rid, ret);
return ret;
}
void TextServerExtension::font_set_embolden(const RID &p_font_rid, double p_strength) {
GDVIRTUAL_CALL(_font_set_embolden, p_font_rid, p_strength);
}

View File

@ -168,6 +168,11 @@ public:
GDVIRTUAL2(_font_set_subpixel_positioning, RID, SubpixelPositioning);
GDVIRTUAL1RC(SubpixelPositioning, _font_get_subpixel_positioning, RID);
virtual void font_set_keep_rounding_remainders(const RID &p_font_rid, bool p_keep_rounding_remainders) override;
virtual bool font_get_keep_rounding_remainders(const RID &p_font_rid) const override;
GDVIRTUAL2(_font_set_keep_rounding_remainders, RID, bool);
GDVIRTUAL1RC(bool, _font_get_keep_rounding_remainders, RID);
virtual void font_set_embolden(const RID &p_font_rid, double p_strength) override;
virtual double font_get_embolden(const RID &p_font_rid) const override;
GDVIRTUAL2(_font_set_embolden, RID, double);