provide a place to set the font

Thanks Ryan Kessler for suggesting this accessibility improvement.
This commit is contained in:
Kartik K. Agaram 2024-02-06 14:56:53 -08:00
parent 9aea053dd1
commit 5b5d3de6d9
3 changed files with 16 additions and 4 deletions

View File

@ -4,7 +4,11 @@ on.initialize = function()
nativefs.mount(Legacy_directory, Directory)
end)
populate_missing_handlers()
if Font_filename == nil then
Font = love.graphics.newFont(Font_height)
else
Font = love.graphics.newFont(Font_filename, Font_height)
end
love.graphics.setFont(Font)
Line_height = math.floor(Font_height*1.3)
Line_number_padding = Line_number_width*Font:getWidth('m')

View File

@ -1,7 +1,11 @@
update_font_settings = function(font_height)
Font_height = font_height
Line_height = math.floor(Font_height*1.3)
if Font_filename == nil then
Font = love.graphics.newFont(Font_height)
else
Font = love.graphics.newFont(Font_filename, Font_height)
end
love.graphics.setFont(Font)
Line_number_padding = Line_number_width*Font:getWidth('m')
Menu_height = 5 + Line_height + 5

4
0158-Font_filename Normal file
View File

@ -0,0 +1,4 @@
-- put in a .ttf or .otf filename here to switch the font
-- the filename must live somewhere Carousel can access: either in the source dir or the save dir
-- A nil filename => use LÖVE's default font
Font_filename = nil