diff options
Diffstat (limited to 'editor/editor_fonts.cpp')
-rw-r--r-- | editor/editor_fonts.cpp | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/editor/editor_fonts.cpp b/editor/editor_fonts.cpp index 8aca007e6b..c50995fc2b 100644 --- a/editor/editor_fonts.cpp +++ b/editor/editor_fonts.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -77,12 +77,27 @@ static Ref<BitmapFont> make_font(int p_height, int p_ascent, int p_valign, int p Ref<DynamicFont> 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<Theme> p_theme) { + /* Custom font */ + + String custom_font = EditorSettings::get_singleton()->get("interface/editor/custom_font"); + Ref<DynamicFontData> 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<DynamicFontData> DefaultFont; @@ -173,11 +188,12 @@ void editor_register_fonts(Ref<Theme> p_theme) { p_theme->set_font("output_source", "EditorFonts", df_output_code); Ref<DynamicFont> df_text_editor_status_code; - df_output_code.instance(); - df_output_code->set_size(14 * EDSCALE); - df_output_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); - df_output_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); - df_output_code->set_font_data(dfmono); - MAKE_FALLBACKS(df_output_code); - p_theme->set_font("status_source", "EditorFonts", df_output_code); + df_text_editor_status_code.instance(); + df_text_editor_status_code->set_size(14 * EDSCALE); + df_text_editor_status_code->set_spacing(DynamicFont::SPACING_TOP, -EDSCALE); + df_text_editor_status_code->set_spacing(DynamicFont::SPACING_BOTTOM, -EDSCALE); + df_text_editor_status_code->set_font_data(dfmono); + MAKE_FALLBACKS(df_text_editor_status_code); + + p_theme->set_font("status_source", "EditorFonts", df_text_editor_status_code); } |