summaryrefslogtreecommitdiffstats
path: root/tools/editor/code_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/code_editor.cpp')
-rw-r--r--tools/editor/code_editor.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/tools/editor/code_editor.cpp b/tools/editor/code_editor.cpp
index 0702974051..a9e31a6561 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -975,7 +975,7 @@ void CodeTextEditor::set_error(const String& p_error) {
}
-void CodeTextEditor::_on_settings_change() {
+void CodeTextEditor::_update_font() {
// FONTS
String editor_font = EDITOR_DEF("text_editor/font", "");
@@ -988,7 +988,12 @@ void CodeTextEditor::_on_settings_change() {
}
}
if(!font_overrode)
- text_editor->add_font_override("font",get_font("source","Fonts"));
+ text_editor->add_font_override("font",get_font("source","EditorFonts"));
+}
+
+void CodeTextEditor::_on_settings_change() {
+
+ _update_font();
// AUTO BRACE COMPLETION
text_editor->set_auto_brace_completion(
@@ -1019,6 +1024,9 @@ void CodeTextEditor::_notification(int p_what) {
if (p_what==EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED)
_load_theme_settings();
+ if (p_what==NOTIFICATION_ENTER_TREE) {
+ _update_font();
+ }
}
void CodeTextEditor::_bind_methods() {
@@ -1044,19 +1052,6 @@ CodeTextEditor::CodeTextEditor() {
find_replace_bar->set_text_edit(text_editor);
- String editor_font = EDITOR_DEF("text_editor/font", "");
- bool font_overrode = false;
- if (editor_font!="") {
- Ref<Font> fnt = ResourceLoader::load(editor_font);
- if (fnt.is_valid()) {
- text_editor->add_font_override("font",fnt);
- font_overrode = true;
- }
- }
-
- if (!font_overrode)
- text_editor->add_font_override("font",get_font("source","Fonts"));
-
text_editor->set_show_line_numbers(true);
text_editor->set_brace_matching(true);
text_editor->set_auto_indent(true);