1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[TextServer] Fix range for zero-width glyphs extra spacing.

This commit is contained in:
Pāvels Nadtočajevs
2025-10-23 21:39:22 +03:00
parent a4607f4522
commit eaa643a4bb
2 changed files with 3 additions and 3 deletions

View File

@@ -6859,8 +6859,8 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star
unsigned int last_non_zero_w = glyph_count - 1; unsigned int last_non_zero_w = glyph_count - 1;
if (last_run) { if (last_run) {
for (unsigned int i = glyph_count - 1; i > 0; i--) { for (int64_t i = glyph_count - 1; i >= 0; i--) {
last_non_zero_w = i; last_non_zero_w = (unsigned int)i;
if (p_sd->orientation == ORIENTATION_HORIZONTAL) { if (p_sd->orientation == ORIENTATION_HORIZONTAL) {
if (glyph_pos[i].x_advance != 0) { if (glyph_pos[i].x_advance != 0) {
break; break;

View File

@@ -4822,7 +4822,7 @@ bool TextServerFallback::_shaped_text_shape(const RID &p_shaped) {
// Text span. // Text span.
int last_non_zero_w = sd->end - 1; int last_non_zero_w = sd->end - 1;
if (i == sd->spans.size() - 1) { if (i == sd->spans.size() - 1) {
for (int j = span.end - 1; j > span.start; j--) { for (int j = span.end - 1; j >= span.start; j--) {
last_non_zero_w = j; last_non_zero_w = j;
uint32_t idx = (int32_t)sd->text[j - sd->start]; uint32_t idx = (int32_t)sd->text[j - sd->start];
if (!is_control(idx) && !(idx >= 0x200B && idx <= 0x200D)) { if (!is_control(idx) && !(idx >= 0x200B && idx <= 0x200D)) {