Skip to content

Commit fcd1cf8

Browse files
authored
Merge pull request #110191 from bruvzg/tx_upd_or
[TextEdit] Fix text edit font update order.
2 parents 6339f31 + 7368d14 commit fcd1cf8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

scene/gui/text_edit.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,19 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
319319
}
320320
String remaining_string = text_with_ime.substr(from);
321321
text_line.data_buf->add_string(remaining_string, font, font_size, language);
322+
}
323+
if (!bidi_override_with_ime.is_empty()) {
324+
TS->shaped_text_set_bidi_override(text_line.data_buf->get_rid(), bidi_override_with_ime);
325+
}
326+
327+
if (!p_text_changed) {
328+
// Update fonts.
329+
RID r = text_line.data_buf->get_rid();
330+
int spans = TS->shaped_get_span_count(r);
331+
for (int i = 0; i < spans; i++) {
332+
TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features());
333+
}
322334

323-
} else {
324335
// Update inline object sizes.
325336
for (int i = 0; i < text_line.data_buf->get_line_count(); i++) {
326337
for (Variant key : text_line.data_buf->get_line_objects(i)) {
@@ -333,17 +344,6 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
333344
}
334345
}
335346
}
336-
if (!bidi_override_with_ime.is_empty()) {
337-
TS->shaped_text_set_bidi_override(text_line.data_buf->get_rid(), bidi_override_with_ime);
338-
}
339-
340-
if (!p_text_changed) {
341-
RID r = text_line.data_buf->get_rid();
342-
int spans = TS->shaped_get_span_count(r);
343-
for (int i = 0; i < spans; i++) {
344-
TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features());
345-
}
346-
}
347347

348348
// Apply tab align.
349349
if (tab_size > 0) {

0 commit comments

Comments
 (0)