[Text Overrun] Add option to set custom ellipsis character, add support for system font fallback.

This commit is contained in:
bruvzg
2023-10-01 13:39:13 +03:00
parent d76c1d0e51
commit 56579f397d
20 changed files with 599 additions and 337 deletions

View File

@ -236,6 +236,9 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_shaped_text_set_custom_punctuation, "shaped", "punct");
GDVIRTUAL_BIND(_shaped_text_get_custom_punctuation, "shaped");
GDVIRTUAL_BIND(_shaped_text_set_custom_ellipsis, "shaped", "char");
GDVIRTUAL_BIND(_shaped_text_get_custom_ellipsis, "shaped");
GDVIRTUAL_BIND(_shaped_text_set_orientation, "shaped", "orientation");
GDVIRTUAL_BIND(_shaped_text_get_orientation, "shaped");
@ -1058,6 +1061,16 @@ String TextServerExtension::shaped_text_get_custom_punctuation(const RID &p_shap
return ret;
}
void TextServerExtension::shaped_text_set_custom_ellipsis(const RID &p_shaped, int64_t p_char) {
GDVIRTUAL_CALL(_shaped_text_set_custom_ellipsis, p_shaped, p_char);
}
int64_t TextServerExtension::shaped_text_get_custom_ellipsis(const RID &p_shaped) const {
int64_t ret = 0;
GDVIRTUAL_CALL(_shaped_text_get_custom_ellipsis, p_shaped, ret);
return ret;
}
void TextServerExtension::shaped_text_set_preserve_invalid(const RID &p_shaped, bool p_enabled) {
GDVIRTUAL_CALL(_shaped_text_set_preserve_invalid, p_shaped, p_enabled);
}

View File

@ -391,6 +391,11 @@ public:
GDVIRTUAL2(_shaped_text_set_custom_punctuation, RID, String);
GDVIRTUAL1RC(String, _shaped_text_get_custom_punctuation, RID);
virtual void shaped_text_set_custom_ellipsis(const RID &p_shaped, int64_t p_char) override;
virtual int64_t shaped_text_get_custom_ellipsis(const RID &p_shaped) const override;
GDVIRTUAL2(_shaped_text_set_custom_ellipsis, RID, int64_t);
GDVIRTUAL1RC(int64_t, _shaped_text_get_custom_ellipsis, RID);
virtual void shaped_text_set_orientation(const RID &p_shaped, Orientation p_orientation = ORIENTATION_HORIZONTAL) override;
virtual Orientation shaped_text_get_orientation(const RID &p_shaped) const override;
GDVIRTUAL2(_shaped_text_set_orientation, RID, Orientation);