support increasing/decreasing font size

This commit is contained in:
Kartik K. Agaram 2024-04-25 16:54:14 -07:00
parent f63c181dd3
commit abd6806e42
3 changed files with 16 additions and 4 deletions

View File

@ -1,8 +1,8 @@
draw_data = function()
love.graphics.setLineWidth(3)
local f, c, py = 36, 50, 5 -- font size, cell side, padding
local namepx = 5
love.graphics.setFont(love.graphics.newFont(f))
local namepx, py = 5, 5
love.graphics.setFont(love.graphics.newFont(Font_size))
local c = love.graphics.getFont():getHeight() + py*2
local rside = max_row_width(Data) + namepx*2 -- width of name column
local nt = table.size(Data)
local hrow = total_row_width(Data) + namepx*2*nt

View File

@ -1,5 +1,16 @@
on.keychord_press = function(chord, key)
if chord == 'C-r' then
if chord == 'C--' then
if Font_size > 2 then
Font_size = Font_size - 1
love.graphics.setFont(love.graphics.newFont(Font_size))
end
elseif chord == 'C-=' then
Font_size = Font_size + 1
love.graphics.setFont(love.graphics.newFont(Font_size))
elseif chord == 'C-0' then
Font_size = 36
love.graphics.setFont(love.graphics.newFont(Font_size))
elseif chord == 'C-r' then
Rows = ordered_keys(Data)
end
end

1
0031-Font_size Normal file
View File

@ -0,0 +1 @@
Font_size = 36