summaryrefslogtreecommitdiffstats
path: root/modules/text_server_adv
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-10-23 11:10:44 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2023-10-23 11:21:13 +0300
commit0fb5d53feb9ee1a51ea1b5e1d8a1fbc4688f4e33 (patch)
tree035c33de31f89e31318ad9388344f239625a0601 /modules/text_server_adv
parent8c25a98fdf68dc388eddaefa188f3386236cdfe4 (diff)
downloadredot-engine-0fb5d53feb9ee1a51ea1b5e1d8a1fbc4688f4e33.tar.gz
[TextServerAdvanced] Keep dynamically loaded ICU data in memory.
Diffstat (limited to 'modules/text_server_adv')
-rw-r--r--modules/text_server_adv/text_server_adv.cpp11
-rw-r--r--modules/text_server_adv/text_server_adv.h1
2 files changed, 7 insertions, 5 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 16046ef053..8987a491cb 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -338,6 +338,7 @@ _FORCE_INLINE_ bool is_connected_to_prev(char32_t p_chr, char32_t p_pchr) {
/*************************************************************************/
bool TextServerAdvanced::icu_data_loaded = false;
+PackedByteArray TextServerAdvanced::icu_data;
bool TextServerAdvanced::_has_feature(Feature p_feature) const {
switch (p_feature) {
@@ -438,7 +439,7 @@ bool TextServerAdvanced::_load_support_data(const String &p_filename) {
return false;
}
uint64_t len = f->get_length();
- PackedByteArray icu_data = f->get_buffer(len);
+ icu_data = f->get_buffer(len);
UErrorCode err = U_ZERO_ERROR;
udata_setCommonData(icu_data.ptr(), &err);
@@ -476,10 +477,10 @@ bool TextServerAdvanced::_save_support_data(const String &p_filename) const {
return false;
}
- PackedByteArray icu_data;
- icu_data.resize(U_ICUDATA_SIZE);
- memcpy(icu_data.ptrw(), U_ICUDATA_ENTRY_POINT, U_ICUDATA_SIZE);
- f->store_buffer(icu_data);
+ PackedByteArray icu_data_static;
+ icu_data_static.resize(U_ICUDATA_SIZE);
+ memcpy(icu_data_static.ptrw(), U_ICUDATA_ENTRY_POINT, U_ICUDATA_SIZE);
+ f->store_buffer(icu_data_static);
return true;
#else
diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h
index f1932d9c50..6ce2692fd3 100644
--- a/modules/text_server_adv/text_server_adv.h
+++ b/modules/text_server_adv/text_server_adv.h
@@ -158,6 +158,7 @@ class TextServerAdvanced : public TextServerExtension {
// ICU support data.
static bool icu_data_loaded;
+ static PackedByteArray icu_data;
mutable USet *allowed = nullptr;
mutable USpoofChecker *sc_spoof = nullptr;
mutable USpoofChecker *sc_conf = nullptr;