Height of a text

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
bert
Prole
Posts: 1
Joined: Wed Oct 31, 2012 12:09 am

Height of a text

Post by bert »

Hi all :) i look for a way to get the height of a multiline text. Is it possible with something like xxx:getWidth(). Anyone has an idea ? :)
User avatar
Xgoff
Party member
Posts: 211
Joined: Fri Nov 19, 2010 4:20 am

Re: Height of a text

Post by Xgoff »

bert wrote:Hi all :) i look for a way to get the height of a multiline text. Is it possible with something like xxx:getWidth(). Anyone has an idea ? :)
weird but i would guess

Code: Select all

your_font:getHeight() * select(2, your_font:getWrap("text you're printing", your_printf_width))
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Height of a text

Post by T-Bone »

I typically store mutliline text as a table with strings, one for each line. That makes it simpler, just

font:getHeight() * #texts
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests