From 34ea0a7d6348bfcb6bf64c8491f9138fbc1d61c4 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Fri, 21 Mar 2025 23:05:06 -0400 Subject: [PATCH] Fix font drawing Previously did not apply specified fonts, only used them for measurements. --- systems/draw.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/systems/draw.lua b/systems/draw.lua index 01b8f15..74e3225 100644 --- a/systems/draw.lua +++ b/systems/draw.lua @@ -40,7 +40,13 @@ drawSystem( "drawText", { position = T.XyPair, drawAsText = { text = T.str, style = Maybe(T.str), font = Maybe(T.FontData) } }, function(e) - local font = e.drawAsText.font or gfx.getFont() -- e.drawAsText.font or AshevilleSans14Bold + local font + if e.drawAsText.font then + font = e.drawAsText.font + gfx.setFont(font) + else + font = gfx.getFont() + end local textHeight = font:getHeight() local textWidth = font:getWidth(e.drawAsText.text)