summaryrefslogtreecommitdiffstats
path: root/tools/editor/code_editor.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-05-29 11:37:26 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-05-29 11:37:52 -0300
commit3e8eb396d7cfec8a96efb78719c0556f1beccf68 (patch)
tree3f6e9adbac4c20989812b338ca7bc3a0b65f568d /tools/editor/code_editor.cpp
parenta5777994cbc06183af7db7d8233434f245d5b089 (diff)
downloadredot-engine-3e8eb396d7cfec8a96efb78719c0556f1beccf68.tar.gz
Finalized DynamicFont implementation
-DynamicFont uses Freetype by default -Editor fonts are now scalable thanks to this -Cleaned up documentation browser and added fonts for this
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 c92b40628c..d605a41600 100644
--- a/tools/editor/code_editor.cpp
+++ b/tools/editor/code_editor.cpp
@@ -544,7 +544,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", "");
@@ -557,7 +557,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(
@@ -588,6 +593,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() {
@@ -607,19 +615,6 @@ CodeTextEditor::CodeTextEditor() {
text_editor->set_area_as_parent_rect();
text_editor->set_margin(MARGIN_BOTTOM,20);
- 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);