Page 1 of 1

A suggestion to improve font workflow

Posted: Fri Jul 17, 2015 8:57 am
by Mystical
I would really appreciate a font:setSize() to prevent redundancy. If there's already a way to set size without big hassle, excuse my invalid complaint.

Re: A suggestion to improve font workflow

Posted: Fri Jul 17, 2015 9:38 am
by kikito
Mystical wrote:I would really appreciate a font:setSize() to prevent redundancy. If there's already a way to set size without big hassle, excuse my invalid complaint.
Hi, I don't understand how that would prevent redundancy. Could you give a more complete example of what you mean?

Re: A suggestion to improve font workflow

Posted: Fri Jul 17, 2015 10:09 am
by Mystical
Hi, I don't understand how that would prevent redundancy. Could you give a more complete example of what you mean?
Instead of creating multiple instances of

Code: Select all

font  = love.graphics.newFont("font.ttf", 12)


you could just use font:setSize(12) to handle size shifting whenever the HUD or Menus require it.

Re: A suggestion to improve font workflow

Posted: Fri Jul 17, 2015 11:17 am
by zorg
Basically, you need to create one font object per font size.

As an alternate route, you can always use love.graphics.scale(wantedsize/fontsize,wantedsize/fontsize) to scale the text you write out with print or printf.

Re: A suggestion to improve font workflow

Posted: Fri Jul 17, 2015 2:00 pm
by Mystical
Love's scaling only scales the rasterized text, not the original vectors. And I really don't want to clutter my code with tons of font objects.

Re: A suggestion to improve font workflow

Posted: Fri Jul 17, 2015 2:56 pm
by airstruck
If I had to guess, I'd say Love's current API reflects the fact that a new texture atlas would need to be created if some attibute of the font were changed, and an API like the one proposed here would lead people to believe that creating texture atlases left and right was somehow cheap, and lead them to do really inefficient things.

Just a guess, though.

Re: A suggestion to improve font workflow

Posted: Fri Jul 17, 2015 3:08 pm
by arampl
This will involve the whole new subsystem creation to do scaling of font outlines. And effect that you want is IMHO too rare to be integrated into framework.

As I mentioned here viewtopic.php?f=4&t=79923&p=182325&hili ... pe#p182325 you can draw all needed letters in Inkscape or other vector editor, save vector info, then build meshes according to this info (beziers, polygon smoothing algorithms etc.) to draw text scaled to any size without losing quality.

EDIT: Even better IMHO: use Blender (or other 3d modeling package of your choice) to create triangulated versions of letters' outlines, save info to some text file then use this.

Re: A suggestion to improve font workflow

Posted: Sun Jul 19, 2015 8:47 am
by Mystical
arampl wrote:This will involve the whole new subsystem creation to do scaling of font outlines. And effect that you want is IMHO too rare to be integrated into framework.

As I mentioned here viewtopic.php?f=4&t=79923&p=182325&hili ... pe#p182325 you can draw all needed letters in Inkscape or other vector editor, save vector info, then build meshes according to this info (beziers, polygon smoothing algorithms etc.) to draw text scaled to any size without losing quality.

EDIT: Even better IMHO: use Blender (or other 3d modeling package of your choice) to create triangulated versions of letters' outlines, save info to some text file then use this.
Thanks man, that's useful. Kinda sucks about the subsystem thing, but having pure vector data for the font might allow me to do some 3D transformation with it.