summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/SCsub2
-rw-r--r--editor/editor_builders.py38
-rw-r--r--editor/editor_settings.cpp6
3 files changed, 41 insertions, 5 deletions
diff --git a/editor/SCsub b/editor/SCsub
index 35c215b663..5dcc253e8b 100644
--- a/editor/SCsub
+++ b/editor/SCsub
@@ -99,6 +99,8 @@ if env["tools"]:
# Fonts
flist = glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.ttf")
flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.otf"))
+ flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff"))
+ flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff2"))
flist.sort()
env.Depends("#editor/builtin_fonts.gen.h", flist)
env.CommandNoCache(
diff --git a/editor/editor_builders.py b/editor/editor_builders.py
index 67d4b8534f..e73fbc6107 100644
--- a/editor/editor_builders.py
+++ b/editor/editor_builders.py
@@ -5,6 +5,10 @@ All such functions are invoked in a subprocess on Windows to prevent build flaki
"""
import os
import os.path
+import shutil
+import subprocess
+import tempfile
+import uuid
from platform_methods import subprocess_main
@@ -89,10 +93,40 @@ def make_translations_header(target, source, env, category):
sorted_paths = sorted(source, key=lambda path: os.path.splitext(os.path.basename(path))[0])
+ msgfmt_available = shutil.which("msgfmt") is not None
+
+ if not msgfmt_available:
+ print("WARNING: msgfmt is not found, using .po files instead of .mo")
+
xl_names = []
for i in range(len(sorted_paths)):
- with open(sorted_paths[i], "rb") as f:
- buf = f.read()
+ if msgfmt_available:
+ mo_path = os.path.join(tempfile.gettempdir(), uuid.uuid4().hex + ".mo")
+ cmd = "msgfmt " + sorted_paths[i] + " --no-hash -o " + mo_path
+ try:
+ subprocess.Popen(cmd, shell=True, stderr=subprocess.PIPE).communicate()
+ with open(mo_path, "rb") as f:
+ buf = f.read()
+ except OSError as e:
+ print(
+ "WARNING: msgfmt execution failed, using .po file instead of .mo: path=%r; [%s] %s"
+ % (sorted_paths[i], e.__class__.__name__, e)
+ )
+ with open(sorted_paths[i], "rb") as f:
+ buf = f.read()
+ finally:
+ try:
+ os.remove(mo_path)
+ except OSError as e:
+ # Do not fail the entire build if it cannot delete a temporary file
+ print(
+ "WARNING: Could not delete temporary .mo file: path=%r; [%s] %s"
+ % (mo_path, e.__class__.__name__, e)
+ )
+ else:
+ with open(sorted_paths[i], "rb") as f:
+ buf = f.read()
+
decomp_size = len(buf)
# Use maximum zlib compression level to further reduce file size
# (at the cost of initial build times).
diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp
index 08cc957ec7..5057fc7531 100644
--- a/editor/editor_settings.cpp
+++ b/editor/editor_settings.cpp
@@ -422,9 +422,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
#endif
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_subpixel_positioning", 1, "Disabled,Auto,One half of a pixel,One quarter of a pixel")
- EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font", "", "*.ttf,*.otf")
- EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font_bold", "", "*.ttf,*.otf")
- EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/code_font", "", "*.ttf,*.otf")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font_bold", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
+ EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/code_font", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
EDITOR_SETTING_USAGE(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/editor/low_processor_mode_sleep_usec", 6900, "1,100000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
// Default unfocused usec sleep is for 10 FPS. Allow an unfocused FPS limit
// as low as 1 FPS for those who really need low power usage (but don't need