From 100565a0c95358ee7b592e994b4615eb44257749 Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Mon, 9 Oct 2023 21:38:23 +0300 Subject: [PATCH] Do not apply extra spacing twice. --- scene/gui/text_edit.cpp | 3 --- scene/resources/primitive_meshes.cpp | 6 ------ scene/resources/text_line.cpp | 6 ------ scene/resources/text_paragraph.cpp | 9 --------- 4 files changed, 24 deletions(-) diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 2f5c05859f0..073f164bdd2 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -212,9 +212,6 @@ void TextEdit::Text::invalidate_cache(int p_line, int p_column, bool p_text_chan for (int i = 0; i < spans; i++) { TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features()); } - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(r, TextServer::SpacingType(i), font->get_spacing(TextServer::SpacingType(i))); - } } // Apply tab align. diff --git a/scene/resources/primitive_meshes.cpp b/scene/resources/primitive_meshes.cpp index 6d848f54948..6c66fca254d 100644 --- a/scene/resources/primitive_meshes.cpp +++ b/scene/resources/primitive_meshes.cpp @@ -2907,9 +2907,6 @@ void TextMesh::_create_mesh_array(Array &p_arr) const { String txt = (uppercase) ? TS->string_to_upper(xl_text, language) : xl_text; TS->shaped_text_add_string(text_rid, txt, font->get_rids(), font_size, font->get_opentype_features(), language); - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(text_rid, TextServer::SpacingType(i), font->get_spacing(TextServer::SpacingType(i))); - } TypedArray stt; if (st_parser == TextServer::STRUCTURED_TEXT_CUSTOM) { @@ -2927,9 +2924,6 @@ void TextMesh::_create_mesh_array(Array &p_arr) const { for (int i = 0; i < spans; i++) { TS->shaped_set_span_update_font(text_rid, i, font->get_rids(), font_size, font->get_opentype_features()); } - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(text_rid, TextServer::SpacingType(i), font->get_spacing(TextServer::SpacingType(i))); - } dirty_font = false; dirty_lines = true; diff --git a/scene/resources/text_line.cpp b/scene/resources/text_line.cpp index 38a865b170c..98527da96bb 100644 --- a/scene/resources/text_line.cpp +++ b/scene/resources/text_line.cpp @@ -200,9 +200,6 @@ void TextLine::set_bidi_override(const Array &p_override) { bool TextLine::add_string(const String &p_text, const Ref &p_font, int p_font_size, const String &p_language, const Variant &p_meta) { ERR_FAIL_COND_V(p_font.is_null(), false); bool res = TS->shaped_text_add_string(rid, p_text, p_font->get_rids(), p_font_size, p_font->get_opentype_features(), p_language, p_meta); - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(rid, TextServer::SpacingType(i), p_font->get_spacing(TextServer::SpacingType(i))); - } dirty = true; return res; } @@ -454,9 +451,6 @@ TextLine::TextLine(const String &p_text, const Ref &p_font, int p_font_siz rid = TS->create_shaped_text(p_direction, p_orientation); if (p_font.is_valid()) { TS->shaped_text_add_string(rid, p_text, p_font->get_rids(), p_font_size, p_font->get_opentype_features(), p_language); - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(rid, TextServer::SpacingType(i), p_font->get_spacing(TextServer::SpacingType(i))); - } } } diff --git a/scene/resources/text_paragraph.cpp b/scene/resources/text_paragraph.cpp index dbf595cb29e..239ecb500e0 100644 --- a/scene/resources/text_paragraph.cpp +++ b/scene/resources/text_paragraph.cpp @@ -397,9 +397,6 @@ bool TextParagraph::set_dropcap(const String &p_text, const Ref &p_font, i TS->shaped_text_clear(dropcap_rid); dropcap_margins = p_dropcap_margins; bool res = TS->shaped_text_add_string(dropcap_rid, p_text, p_font->get_rids(), p_font_size, p_font->get_opentype_features(), p_language); - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(dropcap_rid, TextServer::SpacingType(i), p_font->get_spacing(TextServer::SpacingType(i))); - } lines_dirty = true; return res; } @@ -415,9 +412,6 @@ bool TextParagraph::add_string(const String &p_text, const Ref &p_font, in _THREAD_SAFE_METHOD_ ERR_FAIL_COND_V(p_font.is_null(), false); bool res = TS->shaped_text_add_string(rid, p_text, p_font->get_rids(), p_font_size, p_font->get_opentype_features(), p_language, p_meta); - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(rid, TextServer::SpacingType(i), p_font->get_spacing(TextServer::SpacingType(i))); - } lines_dirty = true; return res; } @@ -1050,9 +1044,6 @@ TextParagraph::TextParagraph(const String &p_text, const Ref &p_font, int rid = TS->create_shaped_text(p_direction, p_orientation); if (p_font.is_valid()) { TS->shaped_text_add_string(rid, p_text, p_font->get_rids(), p_font_size, p_font->get_opentype_features(), p_language); - for (int i = 0; i < TextServer::SPACING_MAX; i++) { - TS->shaped_text_set_spacing(rid, TextServer::SpacingType(i), p_font->get_spacing(TextServer::SpacingType(i))); - } } width = p_width; }