diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index f2882561aa5..c50995fc2be 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -77,12 +77,27 @@ static Ref make_font(int p_height, int p_ascent, int p_valign, int p Ref m_name; \ m_name.instance(); \ m_name->set_size(m_size); \ - m_name->set_font_data(DefaultFont); \ + if (CustomFont.is_valid()) { \ + m_name->set_font_data(CustomFont); \ + m_name->add_fallback(DefaultFont); \ + } else { \ + m_name->set_font_data(DefaultFont); \ + } \ m_name->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); \ m_name->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); \ MAKE_FALLBACKS(m_name); void editor_register_fonts(Ref p_theme) { + /* Custom font */ + + String custom_font = EditorSettings::get_singleton()->get("interface/editor/custom_font"); + Ref CustomFont; + if (custom_font.length() > 0) { + CustomFont.instance(); + CustomFont->set_font_path(custom_font); + CustomFont->set_force_autohinter(true); //just looks better..i think? + } + /* Droid Sans */ Ref DefaultFont; diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 5a16ec7eab0..dc82a02f461 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -277,7 +277,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { _initial_set("interface/editor/source_font_size", 14); hints["interface/editor/source_font_size"] = PropertyInfo(Variant::INT, "interface/editor/source_font_size", PROPERTY_HINT_RANGE, "8,96,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/custom_font", ""); - hints["interface/editor/custom_font"] = PropertyInfo(Variant::STRING, "interface/editor/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.font,*.tres,*.res", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); + hints["interface/editor/custom_font"] = PropertyInfo(Variant::STRING, "interface/editor/custom_font", PROPERTY_HINT_GLOBAL_FILE, "*.ttf,*.otf", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED); _initial_set("interface/editor/dim_editor_on_dialog_popup", true); _initial_set("interface/editor/dim_amount", 0.6f); hints["interface/editor/dim_amount"] = PropertyInfo(Variant::REAL, "interface/editor/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 36448936635..b19d0154558 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1135,16 +1135,5 @@ Ref create_custom_theme(const Ref p_theme) { theme = create_editor_theme(p_theme); } - String global_font = EditorSettings::get_singleton()->get("interface/editor/custom_font"); - if (global_font != "") { - Ref fnt = ResourceLoader::load(global_font); - if (fnt.is_valid()) { - if (!theme.is_valid()) { - theme.instance(); - } - theme->set_default_theme_font(fnt); - } - } - return theme; }