Hey guys,
first post - was mainly lurking the last weeks
At the moment I'm trying to create some game menus from scratch.
There are several buttons which will be filled with text:
Is there any way to determine / calculate the size of the drawn text?
I already searched the forums and wiki but didn't find anything, but as there is an maximum
width option via love.graphics.printf I'm optimistic that this is somehow possible
Getting the size of text / font
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Getting the size of text / font
Hello, and welcome! Since Robin answered your question, I have a question for you: is your avatar Gon? I love that series!
Kurosuke needs beta testers
Re: Getting the size of text / font
Thank you very much. Don't know why I didn't find that
Indeed, my first and still favourite manga. Most people know him from his starring in Tekken thoughtentus wrote:Hello, and welcome! Since Robin answered your question, I have a question for you: is your avatar Gon? I love that series!
- zipperipper
- Prole
- Posts: 45
- Joined: Thu Jan 14, 2010 7:59 pm
- Location: UK
Re: Getting the size of text / font
What about for LÖVE's default font? How would one call :width(string) on LÖVE's default font?
or do I HAVE to create my own? D:
I need a font to use for a console, I've been trying to get a solid courier new but didn't have much luck :U
or do I HAVE to create my own? D:
I need a font to use for a console, I've been trying to get a solid courier new but didn't have much luck :U
Error 404, consciousness not found.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Getting the size of text / font
Can't you use love.graphics.getFont():getWidth("blah")? Or doesn't that work?
Help us help you: attach a .love.
- zipperipper
- Prole
- Posts: 45
- Joined: Thu Jan 14, 2010 7:59 pm
- Location: UK
Re: Getting the size of text / font
No it doesnt, but dont worry, i got it.
it says on http://love2d.org/wiki/Tutorial:Fonts_a ... g_an_image that you can use
to get the default font.
it says on http://love2d.org/wiki/Tutorial:Fonts_a ... g_an_image that you can use
Code: Select all
font = love.graphics.newFont(15)
Error 404, consciousness not found.
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 3 guests