diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-09-20 09:32:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-20 09:32:49 +0200 |
commit | ecd226c6a751f8a20766363fd1f2e1e0e2da8fba (patch) | |
tree | b26188602ee2bfd306a7d096a7ab728a32ebadce /editor/code_editor.cpp | |
parent | f5c15018ac3660e83e98b2d9708fab1c00ec6eb3 (diff) | |
parent | d2536a0cf1c938a7882c73dede753bb78daae04c (diff) |
Merge pull request #11422 from poke1024/fixsourcefontsize2
Better script code font size rescaling on retina displays
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r-- | editor/code_editor.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 5dd8b8a800..8cc117d287 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -993,14 +993,14 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) { } void CodeTextEditor::_zoom_in() { - font_resize_val += 1; + font_resize_val += EDSCALE; if (font_resize_timer->get_time_left() == 0) font_resize_timer->start(); } void CodeTextEditor::_zoom_out() { - font_resize_val -= 1; + font_resize_val -= EDSCALE; if (font_resize_timer->get_time_left() == 0) font_resize_timer->start(); @@ -1064,11 +1064,10 @@ void CodeTextEditor::_font_resize_timeout() { Ref<DynamicFont> font = text_editor->get_font("font"); if (font.is_valid()) { - int size = font->get_size() + font_resize_val; - - if (size >= 8 && size <= 96) { - EditorSettings::get_singleton()->set("interface/source_font_size", size); - font->set_size(size); + int new_size = CLAMP(font->get_size() + font_resize_val, 8 * EDSCALE, 96 * EDSCALE); + if (new_size != font->get_size()) { + EditorSettings::get_singleton()->set("interface/source_font_size", new_size / EDSCALE); + font->set_size(new_size); } font_resize_val = 0; |