diff --git a/doc/classes/EditorExportPlatform.xml b/doc/classes/EditorExportPlatform.xml
index 8792bbedc34..250a03f895f 100644
--- a/doc/classes/EditorExportPlatform.xml
+++ b/doc/classes/EditorExportPlatform.xml
@@ -125,6 +125,12 @@
Returns array of core file names that always should be exported regardless of preset config.
+
+
+
+ Returns additional files that should always be exported regardless of preset configuration, and are not part of the project source. The returned [Dictionary] contains filename keys ([String]) and their corresponding raw data ([PackedByteArray]).
+
+
diff --git a/doc/classes/TextServer.xml b/doc/classes/TextServer.xml
index d76e65b6184..1dd9f634905 100644
--- a/doc/classes/TextServer.xml
+++ b/doc/classes/TextServer.xml
@@ -1067,6 +1067,12 @@
Returns the name of the server interface.
+
+
+
+ Returns default TextServer database (e.g. ICU break iterators and dictionaries).
+
+
diff --git a/doc/classes/TextServerExtension.xml b/doc/classes/TextServerExtension.xml
index 3c27404f8e3..888f97813b7 100644
--- a/doc/classes/TextServerExtension.xml
+++ b/doc/classes/TextServerExtension.xml
@@ -1170,6 +1170,13 @@
Returns the name of the server interface.
+
+
+
+ [b]Optional.[/b]
+ Returns default TextServer database (e.g. ICU break iterators and dictionaries).
+
+
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index 27216c2399a..72fa20f6716 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -900,6 +900,26 @@ String EditorExportPlatform::_get_script_encryption_key(const Refget_script_encryption_key().to_lower();
}
+Dictionary EditorExportPlatform::get_internal_export_files() {
+ Dictionary files;
+
+ // Text server support data.
+ if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA) && (bool)GLOBAL_GET("internationalization/locale/include_text_server_data")) {
+ String ts_name = TS->get_support_data_filename();
+ if (!ts_name.is_empty()) {
+ ts_name = "res://" + ts_name;
+ if (!FileAccess::exists(ts_name)) { // Do not include if user supplied data file exist.
+ const PackedByteArray &ts_data = TS->get_support_data();
+ if (!ts_data.is_empty()) {
+ files[ts_name] = ts_data;
+ }
+ }
+ }
+ }
+
+ return files;
+}
+
Vector EditorExportPlatform::get_forced_export_files() {
Vector files;
@@ -923,25 +943,13 @@ Vector EditorExportPlatform::get_forced_export_files() {
files.push_back(extension_list_config_file);
}
- // Store text server data if it is supported.
- if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA)) {
- bool use_data = GLOBAL_GET("internationalization/locale/include_text_server_data");
- if (use_data) {
- // Try using user provided data file.
- if (!TS->get_support_data_filename().is_empty()) {
- String ts_data = "res://" + TS->get_support_data_filename();
- if (FileAccess::exists(ts_data)) {
- files.push_back(ts_data);
- } else {
- // Use default text server data.
- String abs_path = ProjectSettings::get_singleton()->globalize_path(ts_data);
- ERR_FAIL_COND_V(!TS->save_support_data(abs_path), files);
- if (FileAccess::exists(abs_path)) {
- files.push_back(ts_data);
- // Remove the file later.
- callable_mp_static(DirAccess::remove_absolute).call_deferred(abs_path);
- }
- }
+ // Text server support data.
+ if (TS->has_feature(TextServer::FEATURE_USE_SUPPORT_DATA) && (bool)GLOBAL_GET("internationalization/locale/include_text_server_data")) {
+ String ts_name = TS->get_support_data_filename();
+ if (!ts_name.is_empty()) {
+ ts_name = "res://" + ts_name;
+ if (FileAccess::exists(ts_name)) { // Include user supplied data file.
+ files.push_back(ts_name);
}
}
}
@@ -1510,6 +1518,15 @@ Error EditorExportPlatform::export_project_files(const Ref &
}
}
+ Dictionary int_export = get_internal_export_files();
+ for (const Variant &int_name : int_export.keys()) {
+ const PackedByteArray &array = int_export[int_name];
+ err = p_save_func(p_udata, int_name, array, idx, total, enc_in_filters, enc_ex_filters, key, seed);
+ if (err != OK) {
+ return err;
+ }
+ }
+
String config_file = "project.binary";
String engine_cfb = EditorPaths::get_singleton()->get_cache_dir().path_join("tmp" + config_file);
ProjectSettings::get_singleton()->save_custom(engine_cfb, custom_map, custom_list);
@@ -2427,6 +2444,7 @@ void EditorExportPlatform::_bind_methods() {
ClassDB::bind_method(D_METHOD("ssh_push_to_remote", "host", "port", "scp_args", "src_file", "dst_file"), &EditorExportPlatform::ssh_push_to_remote);
ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_forced_export_files"), &EditorExportPlatform::get_forced_export_files);
+ ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_internal_export_files"), &EditorExportPlatform::get_internal_export_files);
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_NONE);
BIND_ENUM_CONSTANT(EXPORT_MESSAGE_INFO);
diff --git a/editor/export/editor_export_platform.h b/editor/export/editor_export_platform.h
index a33bdce72a7..6b55ecd4b66 100644
--- a/editor/export/editor_export_platform.h
+++ b/editor/export/editor_export_platform.h
@@ -277,6 +277,7 @@ public:
return worst_type;
}
+ static Dictionary get_internal_export_files();
static Vector get_forced_export_files();
virtual bool fill_log_messages(RichTextLabel *p_log, Error p_err);
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp
index 4365927826f..d7a72fd5530 100644
--- a/modules/text_server_adv/text_server_adv.cpp
+++ b/modules/text_server_adv/text_server_adv.cpp
@@ -500,6 +500,20 @@ bool TextServerAdvanced::_save_support_data(const String &p_filename) const {
#endif
}
+PackedByteArray TextServerAdvanced::_get_support_data() const {
+ _THREAD_SAFE_METHOD_
+#ifdef ICU_STATIC_DATA
+
+ PackedByteArray icu_data_static;
+ icu_data_static.resize(U_ICUDATA_SIZE);
+ memcpy(icu_data_static.ptrw(), U_ICUDATA_ENTRY_POINT, U_ICUDATA_SIZE);
+
+ return icu_data_static;
+#else
+ return icu_data;
+#endif
+}
+
bool TextServerAdvanced::_is_locale_right_to_left(const String &p_locale) const {
String l = p_locale.get_slicec('_', 0);
if ((l == "ar") || (l == "dv") || (l == "he") || (l == "fa") || (l == "ff") || (l == "ku") || (l == "ur")) {
diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h
index def57b9372e..06c71dd9c30 100644
--- a/modules/text_server_adv/text_server_adv.h
+++ b/modules/text_server_adv/text_server_adv.h
@@ -732,6 +732,7 @@ public:
MODBIND0RC(String, get_support_data_filename);
MODBIND0RC(String, get_support_data_info);
MODBIND1RC(bool, save_support_data, const String &);
+ MODBIND0RC(PackedByteArray, get_support_data);
MODBIND1RC(bool, is_locale_right_to_left, const String &);
diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp
index a36253ffee7..5753b870c35 100644
--- a/modules/text_server_fb/text_server_fb.cpp
+++ b/modules/text_server_fb/text_server_fb.cpp
@@ -170,6 +170,10 @@ bool TextServerFallback::_save_support_data(const String &p_filename) const {
return false; // No extra data used.
}
+PackedByteArray TextServerFallback::_get_support_data() const {
+ return PackedByteArray(); // No extra data used.
+}
+
bool TextServerFallback::_is_locale_right_to_left(const String &p_locale) const {
return false; // No RTL support.
}
diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h
index 56626c1f6c5..d73735971e5 100644
--- a/modules/text_server_fb/text_server_fb.h
+++ b/modules/text_server_fb/text_server_fb.h
@@ -592,6 +592,7 @@ public:
MODBIND0RC(String, get_support_data_filename);
MODBIND0RC(String, get_support_data_info);
MODBIND1RC(bool, save_support_data, const String &);
+ MODBIND0RC(PackedByteArray, get_support_data);
MODBIND1RC(bool, is_locale_right_to_left, const String &);
diff --git a/servers/text/text_server_extension.cpp b/servers/text/text_server_extension.cpp
index 1c0d518e75a..d1bff879807 100644
--- a/servers/text/text_server_extension.cpp
+++ b/servers/text/text_server_extension.cpp
@@ -42,6 +42,7 @@ void TextServerExtension::_bind_methods() {
GDVIRTUAL_BIND(_get_support_data_filename);
GDVIRTUAL_BIND(_get_support_data_info);
GDVIRTUAL_BIND(_save_support_data, "filename");
+ GDVIRTUAL_BIND(_get_support_data);
GDVIRTUAL_BIND(_is_locale_right_to_left, "locale");
@@ -402,6 +403,12 @@ bool TextServerExtension::save_support_data(const String &p_filename) const {
return ret;
}
+PackedByteArray TextServerExtension::get_support_data() const {
+ PackedByteArray ret;
+ GDVIRTUAL_CALL(_get_support_data, ret);
+ return ret;
+}
+
bool TextServerExtension::is_locale_right_to_left(const String &p_locale) const {
bool ret = false;
GDVIRTUAL_CALL(_is_locale_right_to_left, p_locale, ret);
diff --git a/servers/text/text_server_extension.h b/servers/text/text_server_extension.h
index bd803be8aad..1368b80f6e0 100644
--- a/servers/text/text_server_extension.h
+++ b/servers/text/text_server_extension.h
@@ -63,9 +63,11 @@ public:
virtual String get_support_data_filename() const override;
virtual String get_support_data_info() const override;
virtual bool save_support_data(const String &p_filename) const override;
+ virtual PackedByteArray get_support_data() const override;
GDVIRTUAL0RC(String, _get_support_data_filename);
GDVIRTUAL0RC(String, _get_support_data_info);
GDVIRTUAL1RC(bool, _save_support_data, const String &);
+ GDVIRTUAL0RC(PackedByteArray, _get_support_data);
virtual bool is_locale_right_to_left(const String &p_locale) const override;
GDVIRTUAL1RC(bool, _is_locale_right_to_left, const String &);
diff --git a/servers/text_server.cpp b/servers/text_server.cpp
index d2cf4674ae0..cf85ff5cbb8 100644
--- a/servers/text_server.cpp
+++ b/servers/text_server.cpp
@@ -196,6 +196,7 @@ void TextServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_support_data_filename"), &TextServer::get_support_data_filename);
ClassDB::bind_method(D_METHOD("get_support_data_info"), &TextServer::get_support_data_info);
ClassDB::bind_method(D_METHOD("save_support_data", "filename"), &TextServer::save_support_data);
+ ClassDB::bind_method(D_METHOD("get_support_data"), &TextServer::get_support_data);
ClassDB::bind_method(D_METHOD("is_locale_right_to_left", "locale"), &TextServer::is_locale_right_to_left);
diff --git a/servers/text_server.h b/servers/text_server.h
index f448d62cb22..ff49f190ec7 100644
--- a/servers/text_server.h
+++ b/servers/text_server.h
@@ -244,6 +244,7 @@ public:
virtual String get_support_data_filename() const = 0;
virtual String get_support_data_info() const = 0;
virtual bool save_support_data(const String &p_filename) const = 0;
+ virtual PackedByteArray get_support_data() const = 0;
virtual bool is_locale_right_to_left(const String &p_locale) const = 0;