diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-03-14 08:02:43 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2022-03-14 08:03:25 +0200 |
commit | 4f1660dad7fc6b3fcf5ec33443547d4cd3ebd100 (patch) | |
tree | b4c512d76c5dac6d955054a2d48f43922fdbe84a | |
parent | 7a454842d4bb2c5f96a986df21a97888e1649887 (diff) |
Generate simulated bold font from the custom font if no custom bold font set.
-rw-r--r-- | editor/editor_fonts.cpp | 10 |
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(); |