about summary refs log tree commit diff stats
path: root/edit.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 /edit.lua
parent6601c9fad87fb8b06df442c964486c8050fec3ac (diff)
downloadview.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 'edit.lua')
-rw-r--r--edit.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/edit.lua b/edit.lua
index 7f8a379..ba6acda 100644
--- a/edit.lua
+++ b/edit.lua
@@ -23,7 +23,7 @@ Same_point_distance = 4  -- pixel distance at which two points are considered th
 edit = {}
 
 -- run in both tests and a real run
-function edit.initialize_state(top, left, right, font, line_height)  -- currently always draws to bottom of screen
+function edit.initialize_state(top, left, right, font, font_height, line_height)  -- currently always draws to bottom of screen
   local result = {
     -- a line is either text or a drawing
     -- a text is a table with:
@@ -84,7 +84,7 @@ function edit.initialize_state(top, left, right, font, line_height)  -- currentl
     previous_drawing_mode = nil,  -- extra state for some ephemeral modes like moving/deleting/naming points
 
     font = font,
-    font_height = font:getHeight(),
+    font_height = font_height,
     line_height = line_height,
 
     top = top,
@@ -568,6 +568,7 @@ function edit.initialize_test_state()
       Test_margin_left,
       App.screen.width - Test_margin_right,
       love.graphics.getFont(),
+      14,
       15)  -- line height
 end