diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-26 08:24:54 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-26 08:24:54 +0200 |
commit | 48179f296ac282584762fbf5f80d92f0dec0faba (patch) | |
tree | 338d6745d9313781412eddb9578e4e9e431993fb | |
parent | 5ae6379e5d1ec8d6ea53a2bd04f4302f0fe312ad (diff) | |
parent | 8cdb482738604f191f67bde23a812711d0146dab (diff) |
Merge pull request #66418 from bruvzg/font_fb_order
[TextServer] Always prefer main font over fallbacks, regardless of script/language support.
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 5 | ||||
-rw-r--r-- | modules/text_server_fb/text_server_fb.cpp | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index c97a6ef289..1a4831857f 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -5430,7 +5430,10 @@ bool TextServerAdvanced::shaped_text_shape(const RID &p_shaped) { Array fonts_scr_only; Array fonts_no_match; int font_count = span.fonts.size(); - for (int l = 0; l < font_count; l++) { + if (font_count > 0) { + fonts.push_back(sd->spans[k].fonts[0]); + } + for (int l = 1; l < font_count; l++) { if (font_is_script_supported(span.fonts[l], script)) { if (font_is_language_supported(span.fonts[l], span.language)) { fonts.push_back(sd->spans[k].fonts[l]); diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 7bed22fbb1..9ef0f0ad82 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -2844,7 +2844,10 @@ bool TextServerFallback::shaped_text_add_string(const RID &p_shaped, const Strin // Pre-sort fonts, push fonts with the language support first. Array fonts_no_match; int font_count = p_fonts.size(); - for (int i = 0; i < font_count; i++) { + if (font_count > 0) { + span.fonts.push_back(p_fonts[0]); + } + for (int i = 1; i < font_count; i++) { if (font_is_language_supported(p_fonts[i], p_language)) { span.fonts.push_back(p_fonts[i]); } else { |