diff --git a/0011-on.initialize b/0011-on.initialize index cbf5a00..b89f136 100644 --- a/0011-on.initialize +++ b/0011-on.initialize @@ -1,6 +1,6 @@ on.initialize = function() - love.graphics.setFont(love.graphics.newFont(20)) - Line_height = math.floor(love.graphics.getFont():getHeight()*1.3) + love.graphics.setFont(love.graphics.newFont(Font_height)) + Line_height = math.floor(Font_height*1.3) Line_number_padding = Line_number_width*App.width('m') Menu_left, Menu_top, Safe_width, Safe_height = love.window.getSafeArea() Menu_height = 5 + Line_height + 5 diff --git a/0032-update_font_settings b/0032-update_font_settings index 9bec423..81bdc3e 100644 --- a/0032-update_font_settings +++ b/0032-update_font_settings @@ -1,6 +1,7 @@ update_font_settings = function(font_height) + Font_height = font_height love.graphics.setFont(love.graphics.newFont(font_height)) - Line_height = math.floor(love.graphics.getFont():getHeight()*1.3) + Line_height = math.floor(font_height*1.3) Line_number_padding = Line_number_width*App.width('m') Menu_height = 5 + Line_height + 5 Menu_bottom = Menu_top + Menu_height diff --git a/0068-copy_editor b/0068-copy_editor index 05c6eb1..24d65e7 100644 --- a/0068-copy_editor +++ b/0068-copy_editor @@ -4,7 +4,7 @@ copy_editor = function(state) Safe_height/2-Line_height, -- bottom Menu_left + 50 + Line_number_padding, -- left math.min(100+30*App.width('m'), Safe_width*2/3), -- right - love.graphics.getFont():getHeight(), Line_height) + Font_height, Line_height) new_state.lines = map(state.lines, function(line) return {data=line.data} diff --git a/0069-output_editor_state b/0069-output_editor_state index b33b51d..bca0abc 100644 --- a/0069-output_editor_state +++ b/0069-output_editor_state @@ -3,7 +3,7 @@ output_editor_state = function(editor_state) editor_state.bottom+5+10+5, -- top nil, -- buttom editor_state.left, editor_state.right, - love.graphics.getFont():getHeight(), Line_height) + Font_height, Line_height) Text.redraw_all(result) return result end \ No newline at end of file diff --git a/0070-code_editor_state b/0070-code_editor_state index dfb64b0..e9de5a9 100644 --- a/0070-code_editor_state +++ b/0070-code_editor_state @@ -4,7 +4,7 @@ code_editor_state = function() Safe_height/2-Line_height, -- bottom Menu_left + 50 + Line_number_padding, -- left math.min(100+30*App.width('m'), Safe_width*2/3), -- right - love.graphics.getFont():getHeight(), Line_height) + Font_height, Line_height) Text.redraw_all(result) return result end \ No newline at end of file diff --git a/0081-draw_settings_menu b/0081-draw_settings_menu index eafc8b6..5fbc0ce 100644 --- a/0081-draw_settings_menu +++ b/0081-draw_settings_menu @@ -1,6 +1,6 @@ draw_settings_menu = function() App.color(Menu_background) - local w,h = 200, love.graphics.getFont():getHeight()*8 + local w,h = 200, Font_height*8 local x,y = Safe_width-30-w, Menu_bottom Settings_menu_area = {x=x, y=y, w=w, h=h} love.graphics.rectangle('fill', x,y, w,h) diff --git a/0097-Font_height b/0097-Font_height new file mode 100644 index 0000000..22ad69b --- /dev/null +++ b/0097-Font_height @@ -0,0 +1 @@ +Font_height = 20 \ No newline at end of file diff --git a/0098-on.save_settings b/0098-on.save_settings new file mode 100644 index 0000000..01818a9 --- /dev/null +++ b/0098-on.save_settings @@ -0,0 +1,7 @@ +on.save_settings = function() + return { + font_height = Font_height, + foreground_color = Foreground_color, + background_color = Background_color + } +end \ No newline at end of file diff --git a/0099-on.load_settings b/0099-on.load_settings new file mode 100644 index 0000000..b4ee970 --- /dev/null +++ b/0099-on.load_settings @@ -0,0 +1,10 @@ +on.load_settings = function(settings) + Font_height = settings.font_height or font_height + Background_color = settings.background_color or Background_color + -- careful not to replace the Foreground_color table instance + if settings.foreground_color then + local src = settings.foreground_color + local dest = Foreground_color + dest.r, dest.g, dest.b, dest.a = src.r, src.g, src.b, src.a + end +end \ No newline at end of file