Question on fonts
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 39
- Joined: Sat Nov 28, 2015 10:13 am
Question on fonts
Does rapidly changing fonts cause any performance issues?
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: Question on fonts
Assuming that your fonts are stored in local variables and not being generated every tick/draw frame, I don't see why it would cause performance issues. I guess it kind of depends on exactly what it is that you're doing though.Does rapidly changing fonts cause any performance issues?
One way I can think of that would probably be pretty efficient would be to set a font using:
Code: Select all
font = love.graphics.setNewFont( filename, size )
Code: Select all
love.graphics.print( text, x, y, r, sx, sy, ox, oy, kx, ky )
--or
love.graphics.printf( text, x, y, limit, align )
You could also use:
Code: Select all
love.graphics.newText( font, textstring )
https://love2d.org/wiki/love.graphics.setNewFont
https://love2d.org/wiki/love.graphics.print
https://love2d.org/wiki/love.graphics.printf
https://love2d.org/wiki/love.graphics.newText
I hope this was clear and helps!
Last edited by Sir_Silver on Wed Aug 24, 2016 12:31 am, edited 1 time in total.
- slime
- Solid Snayke
- Posts: 3182
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Question on fonts
There won't be any performance issues as long as you aren't creating new Fonts every frame. Both love.graphics.newFont and love.graphics.setNewFont create an entirely new Font object, so avoid calling either of those in love.draw or love.update.
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: Question on fonts
Ah, well forget about my idea then. 

Re: Question on fonts
Just a slightly different approach to font changes.
Excuse extra material as I was just playing around with shaders.
Excuse extra material as I was just playing around with shaders.
- Attachments
-
font_shader_test.love
- (47.31 KiB) Downloaded 129 times
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 6 guests