about summary refs log tree commit diff stats
path: root/edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-15 22:15:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-15 22:15:07 -0700
commita1da18c107940fa68b5522a76b14d663805796a9 (patch)
treec55c7eb69d6dbef545c764ebad114f81c2d10513 /edit.lua
parent2884f872d84046917919bc36ff5da9425b2a6399 (diff)
downloadtext.love-a1da18c107940fa68b5522a76b14d663805796a9.tar.gz
more precise name
Diffstat (limited to 'edit.lua')
-rw-r--r--edit.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/edit.lua b/edit.lua
index 62aa7a6..c56bccc 100644
--- a/edit.lua
+++ b/edit.lua
@@ -333,13 +333,13 @@ function edit.keychord_pressed(State, chord, key)
     State.search_backup = {cursor={line=State.cursor1.line, pos=State.cursor1.pos}, screen_top={line=State.screen_top1.line, pos=State.screen_top1.pos}}
     assert(State.search_text == nil)
   elseif chord == 'C-=' then
-    initialize_font_settings(State.font_height+2)
+    edit.update_font_settings(State, State.font_height+2)
     Text.redraw_all(State)
   elseif chord == 'C--' then
-    initialize_font_settings(State.font_height-2)
+    edit.update_font_settings(State, State.font_height-2)
     Text.redraw_all(State)
   elseif chord == 'C-0' then
-    initialize_font_settings(20)
+    edit.update_font_settings(State, 20)
     Text.redraw_all(State)
   elseif chord == 'C-z' then
     for _,line in ipairs(State.lines) do line.y = nil end  -- just in case we scroll
@@ -450,6 +450,13 @@ end
 function edit.key_released(State, key, scancode)
 end
 
+function edit.update_font_settings(State, font_height)
+  State.font_height = font_height
+  love.graphics.setFont(love.graphics.newFont(Editor_state.font_height))
+  State.line_height = math.floor(font_height*1.3)
+  State.em = App.newText(love.graphics.getFont(), 'm')
+end
+
 --== some methods for tests
 
 Test_margin_left = 25