mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
[TextServer] Fix system font fallback and caret/selection behavior for composite characters.
This commit is contained in:
@@ -303,6 +303,11 @@ void TextServerExtension::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_shaped_text_next_grapheme_pos, "shaped", "pos");
|
||||
GDVIRTUAL_BIND(_shaped_text_prev_grapheme_pos, "shaped", "pos");
|
||||
|
||||
GDVIRTUAL_BIND(_shaped_text_get_character_breaks, "shaped");
|
||||
GDVIRTUAL_BIND(_shaped_text_next_character_pos, "shaped", "pos");
|
||||
GDVIRTUAL_BIND(_shaped_text_prev_character_pos, "shaped", "pos");
|
||||
GDVIRTUAL_BIND(_shaped_text_closest_character_pos, "shaped", "pos");
|
||||
|
||||
GDVIRTUAL_BIND(_format_number, "string", "language");
|
||||
GDVIRTUAL_BIND(_parse_number, "string", "language");
|
||||
GDVIRTUAL_BIND(_percent_sign, "language");
|
||||
@@ -311,6 +316,7 @@ void TextServerExtension::_bind_methods() {
|
||||
GDVIRTUAL_BIND(_is_valid_identifier, "string");
|
||||
|
||||
GDVIRTUAL_BIND(_string_get_word_breaks, "string", "language", "chars_per_line");
|
||||
GDVIRTUAL_BIND(_string_get_character_breaks, "string", "language");
|
||||
|
||||
GDVIRTUAL_BIND(_is_confusable, "string", "dict");
|
||||
GDVIRTUAL_BIND(_spoof_check, "string");
|
||||
@@ -1333,6 +1339,38 @@ int64_t TextServerExtension::shaped_text_prev_grapheme_pos(const RID &p_shaped,
|
||||
return TextServer::shaped_text_prev_grapheme_pos(p_shaped, p_pos);
|
||||
}
|
||||
|
||||
PackedInt32Array TextServerExtension::shaped_text_get_character_breaks(const RID &p_shaped) const {
|
||||
PackedInt32Array ret;
|
||||
if (GDVIRTUAL_CALL(_shaped_text_get_character_breaks, p_shaped, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return PackedInt32Array();
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_text_next_character_pos(const RID &p_shaped, int64_t p_pos) const {
|
||||
int64_t ret;
|
||||
if (GDVIRTUAL_CALL(_shaped_text_next_character_pos, p_shaped, p_pos, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return TextServer::shaped_text_next_character_pos(p_shaped, p_pos);
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_text_prev_character_pos(const RID &p_shaped, int64_t p_pos) const {
|
||||
int64_t ret;
|
||||
if (GDVIRTUAL_CALL(_shaped_text_prev_character_pos, p_shaped, p_pos, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return TextServer::shaped_text_prev_character_pos(p_shaped, p_pos);
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::shaped_text_closest_character_pos(const RID &p_shaped, int64_t p_pos) const {
|
||||
int64_t ret;
|
||||
if (GDVIRTUAL_CALL(_shaped_text_closest_character_pos, p_shaped, p_pos, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return TextServer::shaped_text_closest_character_pos(p_shaped, p_pos);
|
||||
}
|
||||
|
||||
String TextServerExtension::format_number(const String &p_string, const String &p_language) const {
|
||||
String ret;
|
||||
if (GDVIRTUAL_CALL(_format_number, p_string, p_language, ret)) {
|
||||
@@ -1399,6 +1437,14 @@ PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_str
|
||||
return ret;
|
||||
}
|
||||
|
||||
PackedInt32Array TextServerExtension::string_get_character_breaks(const String &p_string, const String &p_language) const {
|
||||
PackedInt32Array ret;
|
||||
if (GDVIRTUAL_CALL(_string_get_character_breaks, p_string, p_language, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return TextServer::string_get_character_breaks(p_string, p_language);
|
||||
}
|
||||
|
||||
int64_t TextServerExtension::is_confusable(const String &p_string, const PackedStringArray &p_dict) const {
|
||||
int64_t ret;
|
||||
if (GDVIRTUAL_CALL(_is_confusable, p_string, p_dict, ret)) {
|
||||
|
||||
@@ -505,6 +505,15 @@ public:
|
||||
GDVIRTUAL2RC(int64_t, _shaped_text_next_grapheme_pos, RID, int64_t);
|
||||
GDVIRTUAL2RC(int64_t, _shaped_text_prev_grapheme_pos, RID, int64_t);
|
||||
|
||||
virtual PackedInt32Array shaped_text_get_character_breaks(const RID &p_shaped) const override;
|
||||
virtual int64_t shaped_text_next_character_pos(const RID &p_shaped, int64_t p_pos) const override;
|
||||
virtual int64_t shaped_text_prev_character_pos(const RID &p_shaped, int64_t p_pos) const override;
|
||||
virtual int64_t shaped_text_closest_character_pos(const RID &p_shaped, int64_t p_pos) const override;
|
||||
GDVIRTUAL1RC(PackedInt32Array, _shaped_text_get_character_breaks, RID);
|
||||
GDVIRTUAL2RC(int64_t, _shaped_text_next_character_pos, RID, int64_t);
|
||||
GDVIRTUAL2RC(int64_t, _shaped_text_prev_character_pos, RID, int64_t);
|
||||
GDVIRTUAL2RC(int64_t, _shaped_text_closest_character_pos, RID, int64_t);
|
||||
|
||||
virtual String format_number(const String &p_string, const String &p_language = "") const override;
|
||||
virtual String parse_number(const String &p_string, const String &p_language = "") const override;
|
||||
virtual String percent_sign(const String &p_language = "") const override;
|
||||
@@ -518,6 +527,9 @@ public:
|
||||
virtual PackedInt32Array string_get_word_breaks(const String &p_string, const String &p_language = "", int64_t p_chars_per_line = 0) const override;
|
||||
GDVIRTUAL3RC(PackedInt32Array, _string_get_word_breaks, const String &, const String &, int64_t);
|
||||
|
||||
virtual PackedInt32Array string_get_character_breaks(const String &p_string, const String &p_language = "") const override;
|
||||
GDVIRTUAL2RC(PackedInt32Array, _string_get_character_breaks, const String &, const String &);
|
||||
|
||||
virtual bool is_valid_identifier(const String &p_string) const override;
|
||||
GDVIRTUAL1RC(bool, _is_valid_identifier, const String &);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user