Merge pull request #83062 from bruvzg/no_dup_es

Do not apply extra spacing twice.
This commit is contained in:
Rémi Verschelde 2023-10-10 09:12:17 +02:00
commit added7d154
No known key found for this signature in database
GPG Key ID: C3336907360768E1
4 changed files with 0 additions and 24 deletions

View File

@ -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++) { for (int i = 0; i < spans; i++) {
TS->shaped_set_span_update_font(r, i, font->get_rids(), font_size, font->get_opentype_features()); 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. // Apply tab align.

View File

@ -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; 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); 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<Vector3i> stt; TypedArray<Vector3i> stt;
if (st_parser == TextServer::STRUCTURED_TEXT_CUSTOM) { 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++) { 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()); 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_font = false;
dirty_lines = true; dirty_lines = true;

View File

@ -200,9 +200,6 @@ void TextLine::set_bidi_override(const Array &p_override) {
bool TextLine::add_string(const String &p_text, const Ref<Font> &p_font, int p_font_size, const String &p_language, const Variant &p_meta) { bool TextLine::add_string(const String &p_text, const Ref<Font> &p_font, int p_font_size, const String &p_language, const Variant &p_meta) {
ERR_FAIL_COND_V(p_font.is_null(), false); 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); 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; dirty = true;
return res; return res;
} }
@ -454,9 +451,6 @@ TextLine::TextLine(const String &p_text, const Ref<Font> &p_font, int p_font_siz
rid = TS->create_shaped_text(p_direction, p_orientation); rid = TS->create_shaped_text(p_direction, p_orientation);
if (p_font.is_valid()) { 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); 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)));
}
} }
} }

View File

@ -397,9 +397,6 @@ bool TextParagraph::set_dropcap(const String &p_text, const Ref<Font> &p_font, i
TS->shaped_text_clear(dropcap_rid); TS->shaped_text_clear(dropcap_rid);
dropcap_margins = p_dropcap_margins; 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); 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; lines_dirty = true;
return res; return res;
} }
@ -415,9 +412,6 @@ bool TextParagraph::add_string(const String &p_text, const Ref<Font> &p_font, in
_THREAD_SAFE_METHOD_ _THREAD_SAFE_METHOD_
ERR_FAIL_COND_V(p_font.is_null(), false); 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); 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; lines_dirty = true;
return res; return res;
} }
@ -1050,9 +1044,6 @@ TextParagraph::TextParagraph(const String &p_text, const Ref<Font> &p_font, int
rid = TS->create_shaped_text(p_direction, p_orientation); rid = TS->create_shaped_text(p_direction, p_orientation);
if (p_font.is_valid()) { 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); 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; width = p_width;
} }