It looks like you're new here. If you want to get involved, click one of these buttons!
___
Member
main.lua:5: foo.ttf: No such file or directory. stack traceback: |
local font for i = 1, 200 do print(i) font = TTFont.new("foo.ttf", i) end |
Comments
Anyway way don't you just load all your fonts into globals at runtime and just access them?
_G["font1"] = TTFont.new("font1.ttf, 1)
_G["font2"] = TTFont.new("font2.ttf, 2)
etc..
Just an option.
Just wanted to know why this was throwing an error.
Also, if I were using 70 sizes, wouldn't that also throw an error?
Another option might be to create BitmapFonts instead of using the TTF files and load them into texture memory and access them that way--you can of course also scale then instead of directly using different font sizes I would suppose.
Started Player again, runs upto 200 fine. Tried about 10 times.
But I did restart the player yesterday too, it was still giving the errors.
Something is definitely wrong.
Just downloaded PT Sans from http://www.fontsquirrel.com/fonts/PT-Sans , and used PTC55F.ttf
First run - 181, second run - 180, third run - 179, ...
And the folder is the root folder in this test, and /resources/fonts/ in my real game. So can't be that either.
My Apple dev account is pending approval, so I cannot test on a real device yet
Can you try increasing i's limit to maybe a million? See if it crashes anytime soon?
i make it 100000 and receive this error more than 2 times.(Can not check all it is so long:D)
main.lua:5: Roboto-Regular.ttf: Error while reading font file.
stack traceback:
main.lua:5: Roboto-Regular.ttf: Error while reading font file.
stack traceback:
It is weird from this test i understand that this error is generated randomly.
I got "No such file or directory."
Thank you very much for detailed analysis
I don't think that would explain the fact that my game used to crash with the font just being loaded 10-12 times, with the exact same message? That too, with several seconds gap in between.
Likes: Apollo14
https://deluxepixel.com