I am sure there is a simple answer to this but I have been struggling with the problem for the evening and I am out of ideas.
My game loads a .ttf font and displays it just fine when I run it from the editor, but as soon as I package it into a .love file the font can no longer be found. I get a "Cannot open file font.ttf. Does not exist." error. Opening up the .love file as a .zip file shows that it is certainly in there and the file structure hasn't been altered.
Please tell me what am I doing wrong?
Font can no longer be found when I make a .love package
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- NobodysSon
- Prole
- Posts: 33
- Joined: Tue Oct 30, 2012 10:37 pm
Re: Font can no longer be found when I make a .love package
Are you sure the case is correct? E.g. you can't load "font.ttf" in a .love file if the file is called "Font.ttf" or "font.TTF" or stuff like that.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- yetneverdone
- Party member
- Posts: 448
- Joined: Sat Sep 24, 2016 11:20 am
- Contact:
Re: Font can no longer be found when I make a .love package
Where is your font? Make sure the font is in your game directory
My GameDev Website
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
Going Home:A Pixelated Horror Game
My Repositories!
Follow me lovingly!
Nga pala, pinoy ako.
- NobodysSon
- Prole
- Posts: 33
- Joined: Tue Oct 30, 2012 10:37 pm
Re: Font can no longer be found when I make a .love package
Thank you! This turned out to the be the problem... The file is font.TTF and I had it as "font.ttf" in the code. (Told you it would be a simple solution!)Are you sure the case is correct? E.g. you can't load "font.ttf" in a .love file if the file is called "Font.ttf" or "font.TTF" or stuff like that.
Can you explain why it runs without problem from the editor but not when it is bundled up as a .love file?
Thank you for your input too yetneverdone!
Re: Font can no longer be found when I make a .love package
It's because you're using Windows, and by extension the single adequate filesystem Windows supports - NTFS, which is not case sensitive. When you ask this filesystem to fetch a file by name, you can type in characters in any combination of capital and lowercase variants and it'll find the file. When the game is packaged, it no longer operates under filesystem, rather, it's hierarchically stored in a zip archive. When you ask zip archive to fetch an individual file, it will look for a file with exactly the characters you requested, if any one is different then lookup will fail. Most non-Microsoft filesystems are case-sensitive, too.
Re: Font can no longer be found when I make a .love package
You're running this on Windows. While Windows' API for accessing files isn't case sensitive (even though the filesystem is... but that's not relevant), .zip files are. This means it will work flawlessly when loaded from a folder (on Windows only!), but the file will not be found in a .zip.
EDIT: kind of ninja'd, but still, NTFS by itself is case sensitive; it's just Windows' API which isn't. Don't ask me why.
EDIT: kind of ninja'd, but still, NTFS by itself is case sensitive; it's just Windows' API which isn't. Don't ask me why.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
Re: Font can no longer be found when I make a .love package
Yes I stand corrected, the filesystem itself differentiates between character casing, the OS does not - by default (you can enable case sensitivity in OS configuration).
- NobodysSon
- Prole
- Posts: 33
- Joined: Tue Oct 30, 2012 10:37 pm
Re: Font can no longer be found when I make a .love package
Hats off to all of you for the input!
Who is online
Users browsing this forum: Bing [Bot] and 5 guests