diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-21 18:36:07 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-12-21 18:36:07 +0100 |
commit | fecdeb78add6238fe0cfdfb976a632efd6f0f7b1 (patch) | |
tree | 464af79ecd9a5aba7742824e167bcff80c35eb45 /scene | |
parent | f1b23e8c3958d9e7d18c03ca9fea935eae70ea7e (diff) | |
parent | b67a938caaa8fe87496ed076d6871549dfc801d8 (diff) |
Merge pull request #70404 from YuriSizov/theme-!important
Add fallback values for font and scale to the default theme
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 5 | ||||
-rw-r--r-- | scene/theme/theme_db.cpp | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index f179b4b818..571ddee763 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -100,6 +100,11 @@ static Ref<StyleBox> make_empty_stylebox(float p_margin_left = -1, float p_margi void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const Ref<Font> &bold_font, const Ref<Font> &bold_italics_font, const Ref<Font> &italics_font, Ref<Texture2D> &default_icon, Ref<StyleBox> &default_style, float p_scale) { scale = p_scale; + // Default theme properties. + theme->set_default_font(default_font); + theme->set_default_font_size(default_font_size * scale); + theme->set_default_base_scale(scale); + // Font colors const Color control_font_color = Color(0.875, 0.875, 0.875); const Color control_font_low_color = Color(0.7, 0.7, 0.7); diff --git a/scene/theme/theme_db.cpp b/scene/theme/theme_db.cpp index 0268a685fe..ae64313741 100644 --- a/scene/theme/theme_db.cpp +++ b/scene/theme/theme_db.cpp @@ -70,7 +70,9 @@ void ThemeDB::initialize_theme() { Ref<Font> font; if (!font_path.is_empty()) { font = ResourceLoader::load(font_path); - if (!font.is_valid()) { + if (font.is_valid()) { + set_fallback_font(font); + } else { ERR_PRINT("Error loading custom font '" + font_path + "'"); } } @@ -84,9 +86,6 @@ void ThemeDB::initialize_theme() { Ref<Theme> theme = ResourceLoader::load(theme_path); if (theme.is_valid()) { set_project_theme(theme); - if (font.is_valid()) { - set_fallback_font(font); - } } else { ERR_PRINT("Error loading custom theme '" + theme_path + "'"); } |