love.graphics.print very expensive?

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
Goober
Prole
Posts: 6
Joined: Wed Mar 11, 2015 9:28 pm

love.graphics.print very expensive?

Post by Goober »

I'm finding that printing multiple lines using love.graphics.print slows my framerate down significantly. Is this a known thing, or could I be doing something wrong?

[Edit]: Turns out I was setting a new font each time. Woops.

Instead, is there a way to dynamically set a font's size?
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: love.graphics.print very expensive?

Post by arampl »

The answer seems to be 'No'. And scaling is not the way to go with fonts. What are you goals? Animation?
Lapin
Prole
Posts: 19
Joined: Fri Mar 20, 2015 11:53 am

Re: love.graphics.print very expensive?

Post by Lapin »

It's not really heavy, i hope you're using \n instead of making one draw per line, and as said before it may be the font .. (but i don't really think)

Edit : Eh yeah, solved, i'm late.
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: love.graphics.print very expensive?

Post by arampl »

Lapin wrote:i'm late.
Dio Mio!!! No, you're not late at all. I myself forgot to use "\n". Not critical at the moment, but it was silly.
Thanks for the reminder.
User avatar
SiENcE
Party member
Posts: 813
Joined: Thu Jul 24, 2008 2:25 pm
Location: Berlin/Germany
Contact:

Re: love.graphics.print very expensive?

Post by SiENcE »

Yep, love.graphics.print IS VERY expensive! Draw to canvas and only use when updating.
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: love.graphics.print very expensive?

Post by arampl »

SiENcE wrote:Yep, love.graphics.print IS VERY expensive! Draw to canvas and only use when updating.
Not in his case (question already changed):
Goober wrote:[Edit]: Turns out I was setting a new font each time. Woops.

Instead, is there a way to dynamically set a font's size?
Canvases are good with static (or semi-dynamic at least) graphics only. For dynamically changing graphics they're slow it down. I'm already tested this with my vector shapes experiments.

I've an idea for high-quality dynamic fonts & cool effects (like here: http://www.imagemagick.org/Usage/fonts/), which needs testing: Draw all letters in Inkscape, convert them to paths, or beziers, export, then use in LÖVE as a polygon mesh. Maybe even collect kerning info somehow. But what of hinting, hm...

Another opportunity would be to port nanovg's ttf part and load contours directly from font file.

Easily achievable with ImageMagick, but slow. Should be implemented using polygon meshes + shaders:
font1.png
font1.png (28.94 KiB) Viewed 2360 times
font2.png
font2.png (22.94 KiB) Viewed 2360 times
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 4 guests