Merge pull request #70404 from YuriSizov/theme-!important

Add fallback values for font and scale to the default theme
This commit is contained in:
Rémi Verschelde 2022-12-21 18:36:07 +01:00
commit fecdeb78ad
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 8 additions and 4 deletions

View file

@ -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);

View file

@ -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 + "'");
}