Skip to content

Commit

Permalink
Do not apply extra spacing twice.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruvzg committed Oct 9, 2023
1 parent 6916349 commit 100565a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 24 deletions.
3 changes: 0 additions & 3 deletions scene/gui/text_edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 0 additions & 6 deletions scene/resources/primitive_meshes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vector3i> stt;
if (st_parser == TextServer::STRUCTURED_TEXT_CUSTOM) {
Expand All @@ -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;
Expand Down
6 changes: 0 additions & 6 deletions scene/resources/text_line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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;
}
Expand Down Expand Up @@ -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);
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)));
}
}
}

Expand Down
9 changes: 0 additions & 9 deletions scene/resources/text_paragraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,6 @@ bool TextParagraph::set_dropcap(const String &p_text, const Ref<Font> &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;
}
Expand All @@ -415,9 +412,6 @@ bool TextParagraph::add_string(const String &p_text, const Ref<Font> &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;
}
Expand Down Expand Up @@ -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);
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;
}
Expand Down

0 comments on commit 100565a

Please sign in to comment.