about summary refs log tree commit diff stats
path: root/source.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-12-29 11:18:41 -0800
committerKartik K. Agaram <vc@akkartik.com>2023-12-29 11:18:41 -0800
commit0f4aea6db747498467ab5b43a762ef3d5f39f56b (patch)
treeaa3f575583088865f41f0317a3470b0ec064c718 /source.lua
parente36559d264616cc8bc10ebbfcc429663c17fb7aa (diff)
downloadlines.love-0f4aea6db747498467ab5b43a762ef3d5f39f56b.tar.gz
pull font into editor
Now it adjusts the current font for itself.
And it's up to the caller to adjust the current font after.
Diffstat (limited to 'source.lua')
-rw-r--r--source.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/source.lua b/source.lua
index dafb1a7..d6ea40f 100644
--- a/source.lua
+++ b/source.lua
@@ -114,7 +114,7 @@ end
 
 function source.load_settings()
   local settings = Settings.source
-  love.graphics.setFont(love.graphics.newFont(settings.font_height))
+  local font = love.graphics.newFont(settings.font_height)
   -- set up desired window dimensions and make window resizable
   _, _, App.screen.flags = App.screen.size()
   App.screen.flags.resizable = true
@@ -126,7 +126,7 @@ function source.load_settings()
   if Show_log_browser_side then
     right = App.screen.width/2 - Margin_right
   end
-  Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), right, settings.font_height, math.floor(settings.font_height*1.3))
+  Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), right, font, math.floor(settings.font_height*1.3))
   Editor_state.filename = settings.filename
   Editor_state.filename = basename(Editor_state.filename)  -- migrate settings that used full paths; we now support only relative paths within the app
   if settings.cursors then
@@ -152,12 +152,10 @@ end
 
 function source.initialize_default_settings()
   local font_height = 20
-  love.graphics.setFont(love.graphics.newFont(font_height))
+  local font = love.graphics.newFont(font_height)
   source.initialize_window_geometry()
-  Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), App.screen.width-Margin_right)
+  Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), App.screen.width-Margin_right, font, math.floor(font_height*1.3))
   Editor_state.filename = 'run.lua'
-  Editor_state.font_height = font_height
-  Editor_state.line_height = math.floor(font_height*1.3)
 end
 
 function source.initialize_window_geometry()