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

[TextServer] Fix space trimming around mandatory line breaks.

This commit is contained in:
Pāvels Nadtočajevs
2024-12-16 23:37:26 +02:00
parent 4364ed6ccd
commit 7c182a1544
2 changed files with 42 additions and 9 deletions

View File

@@ -890,10 +890,10 @@ PackedInt32Array TextServer::shaped_text_get_line_breaks_adv(const RID &p_shaped
if (last_end <= l_gl[start_pos].start) {
lines.push_back(l_gl[start_pos].start);
lines.push_back(l_gl[end_pos].end);
last_end = l_gl[end_pos].end;
cur_safe_brk = end_pos;
last_end = l_gl[i].end;
cur_safe_brk = i;
}
trim_next = false;
trim_next = true;
} else {
if (last_end <= line_start) {
lines.push_back(line_start);
@@ -1057,15 +1057,15 @@ PackedInt32Array TextServer::shaped_text_get_line_breaks(const RID &p_shaped, do
while ((start_pos < end_pos) && ((l_gl[end_pos].flags & GRAPHEME_IS_SPACE) == GRAPHEME_IS_SPACE || (l_gl[end_pos].flags & GRAPHEME_IS_BREAK_HARD) == GRAPHEME_IS_BREAK_HARD || (l_gl[end_pos].flags & GRAPHEME_IS_BREAK_SOFT) == GRAPHEME_IS_BREAK_SOFT)) {
end_pos -= l_gl[end_pos].count;
}
trim_next = false;
trim_next = true;
if (last_end <= l_gl[start_pos].start) {
lines.push_back(l_gl[start_pos].start);
lines.push_back(l_gl[end_pos].end);
if (p_width > indent) {
l_width = p_width - indent;
}
last_end = l_gl[end_pos].end;
cur_safe_brk = end_pos;
last_end = l_gl[i].end;
cur_safe_brk = i;
}
} else {
if (last_end <= line_start) {