I've got a global font, which loads and draws fine. But when I try to call getTextWidth on it I'm getting a nil. So I put some nil checks in the loading code and I'm just flummoxed here.
Here's my loading code:
print("loading font.")
font_mpl = font.new("mpl-14.fnt")
if font_mpl == nil then print("font is nil") end
gfx.setFont(font_mpl)
if font_mpl == nil then print("font is nil") end
this prints out "loading font." and then "font is nil" twice, but the font still runs and draws properly.
What is happening here?
But if it were failing to load the font (it does actually print "Loading: OK") then the call to setFont would fail no? Anyway, I get the same result if I remove the extension. This feels like me using lua wrongly.