summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-21 11:43:56 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-21 11:43:56 +0100
commita5ccfad22300211afb80904d6c5b3960ef251d4f (patch)
treeaa373d9c0f9fbeab69bb1d6cc4c3176b125037df
parentc40cb24c1cdf419b2a9f14658a477598dd0b10e1 (diff)
parente910aa490c322f50c1caa86743c4b1bf1c2a9a2f (diff)
Merge pull request #68945 from bruvzg/fix_fontawesome_breaks
[TextServer] Fix line breaking for the special fonts that substitute a long string (with breaks opportunities in it) with a single glyph.
-rw-r--r--modules/text_server_adv/text_server_adv.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 166325c551..cf2d8c9986 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -4750,7 +4750,10 @@ bool TextServerAdvanced::_shaped_text_update_breaks(const RID &p_shaped) {
i += (sd_glyphs[i].count - 1);
}
}
- ERR_FAIL_COND_V_MSG(sd_shift != sd->break_inserts, false, "Invalid break insert count!");
+ if (sd_shift < sd->break_inserts) {
+ // Note: should not happen with a normal text, but might be a case with special fonts that substitute a long string (with breaks opportunities in it) with a single glyph (like Font Awesome).
+ glyphs_new.resize(sd->glyphs.size() + sd_shift);
+ }
if (sd->break_inserts > 0) {
sd->glyphs = glyphs_new;