summaryrefslogtreecommitdiff
path: root/modules/text_server_adv
diff options
context:
space:
mode:
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r--modules/text_server_adv/SCsub2
-rw-r--r--modules/text_server_adv/dynamic_font_adv.cpp2
-rw-r--r--modules/text_server_adv/text_server_adv.cpp32
3 files changed, 17 insertions, 19 deletions
diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub
index a55b6dc283..d06c5c2f14 100644
--- a/modules/text_server_adv/SCsub
+++ b/modules/text_server_adv/SCsub
@@ -131,7 +131,7 @@ if env["builtin_harfbuzz"]:
]
)
- if env["platform"] == "android" or env["platform"] == "linuxbsd" or env["platform"] == "server":
+ if env["platform"] == "android" or env["platform"] == "linuxbsd":
env_harfbuzz.Append(CCFLAGS=["-DHAVE_PTHREAD"])
if env["platform"] == "javascript":
diff --git a/modules/text_server_adv/dynamic_font_adv.cpp b/modules/text_server_adv/dynamic_font_adv.cpp
index faeb83f920..c29aac05bb 100644
--- a/modules/text_server_adv/dynamic_font_adv.cpp
+++ b/modules/text_server_adv/dynamic_font_adv.cpp
@@ -66,7 +66,7 @@ DynamicFontDataAdvanced::DataAtSize *DynamicFontDataAdvanced::get_data_for_size(
ERR_FAIL_V_MSG(nullptr, "Cannot open font file '" + font_path + "'.");
}
- uint64_t len = f->get_len();
+ uint64_t len = f->get_length();
font_mem_cache.resize(len);
f->get_buffer(font_mem_cache.ptrw(), len);
font_mem = font_mem_cache.ptr();
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 361852547f..906ebe4993 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -181,7 +181,7 @@ bool TextServerAdvanced::load_support_data(const String &p_filename) {
UErrorCode err = U_ZERO_ERROR;
// ICU data found.
- uint64_t len = f->get_len();
+ uint64_t len = f->get_length();
icu_data = (uint8_t *)memalloc(len);
f->get_buffer(icu_data, len);
f->close();
@@ -2352,24 +2352,22 @@ bool TextServerAdvanced::shaped_text_shape(RID p_shaped) {
sd->glyphs.push_back(gl);
} else {
Vector<RID> fonts;
- // Push fonts with the language and script support first.
- for (int l = 0; l < span.fonts.size(); l++) {
- if ((font_is_language_supported(span.fonts[l], span.language)) && (font_is_script_supported(span.fonts[l], script))) {
- fonts.push_back(sd->spans[k].fonts[l]);
- }
- }
- // Push fonts with the script support.
- for (int l = 0; l < sd->spans[k].fonts.size(); l++) {
- if (!(font_is_language_supported(span.fonts[l], span.language)) && (font_is_script_supported(span.fonts[l], script))) {
- fonts.push_back(sd->spans[k].fonts[l]);
- }
- }
- // Push the rest valid fonts.
- for (int l = 0; l < sd->spans[k].fonts.size(); l++) {
- if (!(font_is_language_supported(span.fonts[l], span.language)) && !(font_is_script_supported(span.fonts[l], script))) {
- fonts.push_back(sd->spans[k].fonts[l]);
+ Vector<RID> fonts_scr_only;
+ Vector<RID> fonts_no_match;
+ int font_count = span.fonts.size();
+ for (int l = 0; 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]);
+ } else {
+ fonts_scr_only.push_back(sd->spans[k].fonts[l]);
+ }
+ } else {
+ fonts_no_match.push_back(sd->spans[k].fonts[l]);
}
}
+ fonts.append_array(fonts_scr_only);
+ fonts.append_array(fonts_no_match);
_shape_run(sd, MAX(sd->spans[k].start, script_run_start), MIN(sd->spans[k].end, script_run_end), sd->script_iter->script_ranges[j].script, bidi_run_direction, fonts, k, 0);
}
}