Personal greetings. Eventually some of my project has a random "crash" at startup of either sprite that has text inside it.
The debug output reports the phrase "Invalid font size." and points the line that has a font etc ...
Good but this has been happening quite randomly, and when closing and reopening the error does not happen. And the font / text with error is no longer wrong and displays normally.
What could cause this? They are different types of fonts and different sizes, but then it works again.
"Invalid font size."
Comments
In my case the "invalid font size" is taken from a macro which I define in init.lua. Is your font size also a macro, or a "normal" var?
Likes: kinrpg
In this example I put 20 in size.
local fontP = TTFont.new("Fontes/Hobby-of-night.ttf", 20)
https://deluxepixel.com
@SinisterSoft I also create all fonts at startup and then re-use them. Even so, I get this problem every now and then. I assume it's to do with too many files open in the player?
And I'm sorry, I accidentally clicked Reject and did not find where to undo this.
Likes: kinrpg
Update: Since using manual garbage collection didn't work (at least not in all cases), the workaround was creating a font cache mechanism so that fonts that were already created can be reused. This is a workaround and the issue should still be correctly resolved .
Yet another update: On a Samsung tablet this "invalid font size" crash can occur even after creating 3 TTFonts. There's seems to be a bug with TTFont.new that makes it unusable on some devices.