Page 1 of 1
love.graphics.print very expensive?
Posted: Fri Mar 27, 2015 12:55 am
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?
Re: love.graphics.print very expensive?
Posted: Fri Mar 27, 2015 1:41 am
by arampl
The answer seems to be 'No'. And scaling is not the way to go with fonts. What are you goals? Animation?
Re: love.graphics.print very expensive?
Posted: Fri Mar 27, 2015 10:23 pm
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.
Re: love.graphics.print very expensive?
Posted: Sat Mar 28, 2015 3:56 am
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.
Re: love.graphics.print very expensive?
Posted: Thu Apr 02, 2015 3:13 pm
by SiENcE
Yep, love.graphics.print IS VERY expensive! Draw to canvas and only use when updating.
Re: love.graphics.print very expensive?
Posted: Fri Apr 03, 2015 12:10 am
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 (28.94 KiB) Viewed 2366 times

- font2.png (22.94 KiB) Viewed 2366 times