Page 2 of 3

Re: Complete Noob - Drawing text in layers

Posted: Thu Sep 07, 2017 11:32 am
by RogerH
Hi all,

having more success now - I've come across a problem with fonts though.

I'm trying to use a mono font so that all mycharacters are the same width.

I've tried:

Code: Select all

Font = love.graphics.newFont("C:/Windows/Fonts/Deja Vu Sans Mono/Deja Vu Sans Mono.ttf", 48)
and:

Code: Select all

Font = love.graphics.newFont("C:/Windows/Fonts/Deja Vu Sans Mono.ttf", 48)
But I'm getting a 'does not exist' message.

I've looked for any tutorials on this but they seem to assume I'd know how to do this bit, lol!

What am I doing wrong?

Thanks as always for your help.

Roger.

Re: Complete Noob - Drawing text in layers

Posted: Thu Sep 07, 2017 12:52 pm
by Sir_Silver
You need to store the font(s) that you want to use somewhere inside of your game's folder (where you have your main.lua). If you store the font in the same folder as your main.lua you can load it like:

Code: Select all

Font = love.graphics.newFont("Deja Vu Sans Mono.ttf", 48)
You want to store your fonts packaged with your game because people that don't have this font will end up with a game that crashes.

Re: Complete Noob - Drawing text in layers

Posted: Thu Sep 07, 2017 11:46 pm
by zorg
To expand on the above, you're attempting to use absolute paths where only relative ones are accepted.
Relative to both your save directory, and where your main.lua is (in a folder OR in a .love file, which is just a zip archive).

Re: Complete Noob - Drawing text in layers

Posted: Fri Sep 08, 2017 7:29 am
by RogerH
Hi all,

Having some success now thanks to your help.

However, I'm trying to specify a monospaced font and can't get it to work.

I have tried:

Code: Select all

Font = love.graphics.newFont("C:/Windows/Fonts/Deja Vu Sans Mono.ttf", 48)
and:

Code: Select all

Font = love.graphics.newFont("C:/Windows/Fonts/Deja Vu Sans Mono/Deja Vu Sans Mono.ttf", 48)
but I'm getting a 'file does not exist' error.

I've had a look for font tutorials but they seem to assume I'll get this part right, lol!

What am I doing wrong in specifying the font?

many thanks in advance,

Roger.

Re: Complete Noob - Drawing text in layers

Posted: Fri Sep 08, 2017 8:03 am
by bartbes
Please don't triple post. And you've just asked the exact same question twice, ignoring the answers you got.

Re: Complete Noob - Drawing text in layers

Posted: Fri Sep 08, 2017 8:16 am
by RogerH
yes - and I apologised in my last post for the duplicate - as I said I'm a noob and i will make mistakes. If it helps, I apologise again for the dup[licate post.

Re: Complete Noob - Drawing text in layers

Posted: Fri Sep 08, 2017 9:43 am
by bartbes
RogerH wrote: Fri Sep 08, 2017 8:16 am yes - and I apologised in my last post for the duplicate - as I said I'm a noob and i will make mistakes. If it helps, I apologise again for the dup[licate post.
And then you triple post AGAIN.

Re: Complete Noob - Drawing text in layers

Posted: Fri Sep 08, 2017 1:49 pm
by RogerH
OMG! I have no idea how I'm doing that! So sorry!

Seriously, someone tell me how I keep doing that? I'm really not trying to annoy you - honest.

Re: Complete Noob - Drawing text in layers

Posted: Fri Sep 08, 2017 2:08 pm
by RogerH
Ok so I figured out how to delete the double/triple posts - now all I have to do is figure out how I managed to do it in the first place.

Really sorry everyone - I'm new to this lark and didn't realise I was doing it.

Re: Complete Noob - Drawing text in layers

Posted: Fri Sep 08, 2017 2:23 pm
by grump
lol, this is hilarious