diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-08-19 11:19:09 +0300 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-08-19 11:49:34 +0300 |
commit | 07d859de25572052250512e344b88e5641bedd00 (patch) | |
tree | 1b15fe93689326aad447b08d50c5cabe211b06fb /modules/text_server_adv | |
parent | b51ee8b029b0b9f719f01bbdd21a329e65d4d238 (diff) | |
download | redot-engine-07d859de25572052250512e344b88e5641bedd00.tar.gz |
[TextServer] Fix issues with character breaks, add more tests.
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 7855f75877..804a16423d 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -4864,8 +4864,7 @@ void TextServerAdvanced::_update_chars(ShapedTextDataAdvanced *p_sd) const { while (i + 1 < spans.size() && language == spans[i + 1].language) { i++; } - int r_end = MIN(spans[i].end - p_sd->start, p_sd->text.size()); - + int r_end = MIN(spans[i].end - p_sd->start, p_sd->text.length()); UBreakIterator *bi = ubrk_open(UBRK_CHARACTER, (language.is_empty()) ? TranslationServer::get_singleton()->get_tool_locale().ascii().get_data() : language.ascii().get_data(), data + _convert_pos_inv(p_sd, r_start), _convert_pos_inv(p_sd, r_end - r_start), &err); if (U_SUCCESS(err)) { while (ubrk_next(bi) != UBRK_DONE) { @@ -4877,9 +4876,9 @@ void TextServerAdvanced::_update_chars(ShapedTextDataAdvanced *p_sd) const { } ubrk_close(bi); } else { - for (int j = r_start; j <= r_end; j++) { + for (int j = r_start; j < r_end; j++) { if (prev != j) { - p_sd->chars.push_back(j + p_sd->start); + p_sd->chars.push_back(j + 1 + p_sd->start); } prev = j; } |