Page 1 of 1
access to fonts directory
Posted: Sun Jun 17, 2018 10:15 pm
by logoliv
Hi,
I'm just trying to create a new font without copying the file in my main.lua directory (using the Windows Fonts instead) but it doesn't work :
Code: Select all
font = love.graphics.newFont("C:/Windows/Fonts/segoeui.ttf", 16)
love.graphics.setFont(font)
I obtain a "file not found" error...
Is there another way to specify the Windows directory, like a special variable ? Or perhaps the way to write the path is incorrect ?
Any help would be welcome, thanks.
Re: file system / path
Posted: Sun Jun 17, 2018 10:48 pm
by pgimeno
You can copy the file to a subfolder in your application and reference it with a relative path.
LÖVE is made to be cross platform. It is not Windows-specific. I use Linux and I would not be able to use a program that depends on Windows- or MacOS-specific directories, just as you wouldn't be able to use a program that depends on Linux- or MacOS-specific directories. LÖVE is designed to encourage cross-platform compatibility, that's why you can't do it.
Re: file system / path
Posted: Mon Jun 18, 2018 10:47 am
by logoliv
Thanks for your answer.
So the only possible paths are in subfolders relative to my application ?
I don't plan to port it to Linux or MacOS, nor distribute it... just want to use it on my pc !
And i find stupid to include a 1Mb font file just to have a new font, where i only use 10kb for my application lua code...
Could somebody tell me all the environment variables accessible in Löve please ?
Re: file system / path
Posted: Mon Jun 18, 2018 11:33 am
by ivan
logoliv wrote: ↑Mon Jun 18, 2018 10:47 am
So the only possible paths are in subfolders relative to my application ?
Even if you could access "C:\\Windows" note that your script file won't work if I have Windows installed to drive D:\\
You can also access the appData directory but this is usually for save files and temporary data.
logoliv wrote: ↑Mon Jun 18, 2018 10:47 am
And i find stupid to include a 1Mb font file just to have a new font, where i only use 10kb for my application lua code...
There are ways to trim down your font file, for example using BMFont or bitmap fonts.
You need to redistribute your assets otherwise the .love file wont work across platforms.
It's just how Love2D works, it's not stupid but a very mindful limitation.
Could somebody tell me all the environment variables accessible in Löve please ?
Environment variables are something different altogether and vary between operating systems.
See
https://www.lua.org/pil/22.2.html
Re: access to fonts directory
Posted: Mon Jun 18, 2018 12:00 pm
by pgimeno
As I said, LÖVE is designed to encourage cross-platform compatibility, so these things are out of the scope of what it is designed to do. Still, you can do what you want, but it's not easy. You need to mount the folder using PhysFS via FFI. I believe zorg is working on a library to make that easier, but in the meantime, you can try this solution by grump:
viewtopic.php?p=218501#p218501
Disclaimer: I have not tried it, therefore I don't know whether it will work.
Re: access to fonts directory
Posted: Mon Jun 18, 2018 7:12 pm
by zorg
pgimeno wrote: ↑Mon Jun 18, 2018 12:00 pm
As I said, LÖVE is designed to encourage cross-platform compatibility, so these things are out of the scope of what it is designed to do. Still, you can do what you want, but it's not easy. You need to mount the folder using PhysFS via FFI.
I believe zorg is working on a library to make that easier, but in the meantime, you can try this solution by grump:
viewtopic.php?p=218501#p218501
Disclaimer: I have not tried it, therefore I don't know whether it will work.
I am
I just prioritize things with deadlines, like music compositions for albums... and a certain squid paintball game dlc came out not long ago, and that ate quite a bit of chunk of my time as well...
But i will soon get my bearings back together, and github and release the thing.