Complete Noob - Drawing text in layers

General discussion about LÖVE, Lua, game development, puns, and unicorns.
RogerH
Prole
Posts: 13
Joined: Sun Sep 03, 2017 4:06 pm

Re: Complete Noob - Drawing text in layers

Post 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.
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Complete Noob - Drawing text in layers

Post 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.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Complete Noob - Drawing text in layers

Post 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).
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
RogerH
Prole
Posts: 13
Joined: Sun Sep 03, 2017 4:06 pm

Re: Complete Noob - Drawing text in layers

Post 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.
Last edited by RogerH on Fri Sep 08, 2017 2:09 pm, edited 2 times in total.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Complete Noob - Drawing text in layers

Post by bartbes »

Please don't triple post. And you've just asked the exact same question twice, ignoring the answers you got.
RogerH
Prole
Posts: 13
Joined: Sun Sep 03, 2017 4:06 pm

Re: Complete Noob - Drawing text in layers

Post 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.
Last edited by RogerH on Fri Sep 08, 2017 2:06 pm, edited 2 times in total.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Complete Noob - Drawing text in layers

Post 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.
RogerH
Prole
Posts: 13
Joined: Sun Sep 03, 2017 4:06 pm

Re: Complete Noob - Drawing text in layers

Post 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.
RogerH
Prole
Posts: 13
Joined: Sun Sep 03, 2017 4:06 pm

Re: Complete Noob - Drawing text in layers

Post 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.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Complete Noob - Drawing text in layers

Post by grump »

lol, this is hilarious
Post Reply

Who is online

Users browsing this forum: Bing [Bot], totoetlititi and 15 guests