about summary refs log tree commit diff stats
path: root/run.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-12-29 11:52:28 -0800
committerKartik K. Agaram <vc@akkartik.com>2023-12-29 11:52:28 -0800
commitbd2179d8aa37e6088f20faae08fd6564a33e18c1 (patch)
tree9775eb972fa69ca272f681a4186ce508d9c4c494 /run.lua
parent6601c9fad87fb8b06df442c964486c8050fec3ac (diff)
downloadlines.love-bd2179d8aa37e6088f20faae08fd6564a33e18c1.tar.gz
bugfix
scenario: run without config file, quit, run again
expected: font size remains the same on second run

Before this commit it was increasing on each run.
It turns out the font height that you pass into love.graphics.newFont()
is not the result of font:getHeight().
Diffstat (limited to 'run.lua')
-rw-r--r--run.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/run.lua b/run.lua
index fd01f46..2cdd892 100644
--- a/run.lua
+++ b/run.lua
@@ -61,7 +61,7 @@ function run.load_settings()
   App.screen.width, App.screen.height = Settings.width, Settings.height
   App.screen.resize(App.screen.width, App.screen.height, App.screen.flags)
   run.set_window_position_from_settings(Settings)
-  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, math.floor(Settings.font_height*1.3))
+  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, Settings.font_height, math.floor(Settings.font_height*1.3))
   Editor_state.filename = Settings.filename
   Editor_state.screen_top1 = Settings.screen_top
   Editor_state.cursor1 = Settings.cursor
@@ -81,7 +81,7 @@ function run.initialize_default_settings()
   local font_height = 20
   local font = love.graphics.newFont(font_height)
   run.initialize_window_geometry()
-  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, math.floor(font_height*1.3))
+  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right, font, font_height, math.floor(font_height*1.3))
   Settings = run.settings()
 end