Pārlūkot izejas kodu

Merge pull request #110191 from bruvzg/tx_upd_or

[TextEdit] Fix text edit font update order.
Clay John 1 nedēļu atpakaļ
vecāks
revīzija
fcd1cf8d57
1 mainītis faili ar 12 papildinājumiem un 12 dzēšanām
  1. 12 12
      scene/gui/text_edit.cpp

+ 12 - 12
scene/gui/text_edit.cpp

@@ -319,8 +319,19 @@ void TextEdit::Text::invalidate_cache(int p_line, bool p_text_changed) {
 		}
 		String remaining_string = text_with_ime.substr(from);
 		text_line.data_buf->add_string(remaining_string, font, font_size, language);
+	}
+	if (!bidi_override_with_ime.is_empty()) {
+		TS->shaped_text_set_bidi_override(text_line.data_buf->get_rid(), bidi_override_with_ime);
+	}
+
+	if (!p_text_changed) {
+		// Update fonts.
+		RID r = text_line.data_buf->get_rid();
+		int spans = TS->shaped_get_span_count(r);
+		for (int i = 0; i < spans; i++) {
+			TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features());
+		}
 
-	} else {
 		// Update inline object sizes.
 		for (int i = 0; i < text_line.data_buf->get_line_count(); i++) {
 			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) {
 			}
 		}
 	}
-	if (!bidi_override_with_ime.is_empty()) {
-		TS->shaped_text_set_bidi_override(text_line.data_buf->get_rid(), bidi_override_with_ime);
-	}
-
-	if (!p_text_changed) {
-		RID r = text_line.data_buf->get_rid();
-		int spans = TS->shaped_get_span_count(r);
-		for (int i = 0; i < spans; i++) {
-			TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features());
-		}
-	}
 
 	// Apply tab align.
 	if (tab_size > 0) {