summaryrefslogtreecommitdiff
path: root/editor/editor_fonts.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-12-13 20:05:27 +0100
committerGitHub <noreply@github.com>2020-12-13 20:05:27 +0100
commit06314c1b0e8100546a53cf2786fa244c5d19af6f (patch)
tree20f75fac2110d3466e759d51518b5202506490ff /editor/editor_fonts.cpp
parentbbf7bb383810f397760961cb1666860f9b0791b8 (diff)
parentc1d261fdb09db3aae4c7fa6587812a697f2ea8cd (diff)
Merge pull request #43030 from bruvzg/ctl_var_font
[Complex Text Layouts] Add variable fonts support.
Diffstat (limited to 'editor/editor_fonts.cpp')
-rw-r--r--editor/editor_fonts.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index f5bb4921d4..23dc69af12 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -161,6 +161,14 @@ void editor_register_fonts(Ref<Theme> p_theme) {
CustomFontSource->load_resource(custom_font_path_source, default_font_size);
CustomFontSource->set_antialiased(font_antialiased);
CustomFontSource->set_hinting(font_hinting);
+
+ Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_variations")).split(",");
+ for (int i = 0; i < subtag.size(); i++) {
+ Vector<String> subtag_a = subtag[i].split("=");
+ if (subtag_a.size() == 2) {
+ CustomFontSource->set_variation(subtag_a[0], subtag_a[1].to_float());
+ }
+ }
} else {
EditorSettings::get_singleton()->set_manually("interface/editor/code_font", "");
}
@@ -282,6 +290,15 @@ void editor_register_fonts(Ref<Theme> p_theme) {
dfmono->set_antialiased(font_antialiased);
dfmono->set_hinting(font_hinting);
+ Vector<String> subtag = String(EditorSettings::get_singleton()->get("interface/editor/code_font_custom_variations")).split(",");
+ Dictionary ftrs;
+ for (int i = 0; i < subtag.size(); i++) {
+ Vector<String> subtag_a = subtag[i].split("=");
+ if (subtag_a.size() == 2) {
+ dfmono->set_variation(subtag_a[0], subtag_a[1].to_float());
+ }
+ }
+
// Default font
MAKE_DEFAULT_FONT(df);
p_theme->set_default_theme_font(df); // Default theme font