summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-14 08:30:25 +0100
committerGitHub <noreply@github.com>2022-03-14 08:30:25 +0100
commitc7bfaf3310120ca7a930b09372778720d2f248d5 (patch)
tree316a753db06a3ef422edbc9a3f7fcd024e6f36e8
parent07b10d6d4f340fa4c6237d9557b63c5dadc60890 (diff)
parent4f1660dad7fc6b3fcf5ec33443547d4cd3ebd100 (diff)
Merge pull request #59127 from bruvzg/custom_font_bold
-rw-r--r--editor/editor_fonts.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp
index cd9298a122..7b72e09bd7 100644
--- a/editor/editor_fonts.cpp
+++ b/editor/editor_fonts.cpp
@@ -206,7 +206,8 @@ void editor_register_fonts(Ref<Theme> p_theme) {
break;
}
- int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE;
+ const int default_font_size = int(EDITOR_GET("interface/editor/main_font_size")) * EDSCALE;
+ const float embolden_strength = 0.6;
String custom_font_path = EditorSettings::get_singleton()->get("interface/editor/main_font");
Ref<FontData> CustomFont;
@@ -226,6 +227,11 @@ void editor_register_fonts(Ref<Theme> p_theme) {
EditorSettings::get_singleton()->set_manually("interface/editor/main_font_bold", "");
}
+ if (CustomFont.is_valid() && !CustomFontBold.is_valid()) {
+ CustomFontBold = CustomFont->duplicate();
+ CustomFontBold->set_embolden(embolden_strength);
+ }
+
/* Custom source code font */
String custom_font_path_source = EditorSettings::get_singleton()->get("interface/editor/code_font");
@@ -268,8 +274,6 @@ void editor_register_fonts(Ref<Theme> p_theme) {
Ref<FontData> FontFallback = load_cached_internal_font(_font_DroidSansFallback, _font_DroidSansFallback_size, font_hinting, font_antialiased, true, font_subpixel_positioning);
Ref<FontData> FontJapanese = load_cached_internal_font(_font_DroidSansJapanese, _font_DroidSansJapanese_size, font_hinting, font_antialiased, true, font_subpixel_positioning);
- const float embolden_strength = 0.6;
-
Ref<FontData> FontFallbackBold = FontFallback->duplicate();
FontFallbackBold->set_embolden(embolden_strength);
Ref<FontData> FontJapaneseBold = FontJapanese->duplicate();