A suggestion to improve font workflow

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Mystical
Prole
Posts: 7
Joined: Sun Mar 15, 2015 4:39 pm

A suggestion to improve font workflow

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: A suggestion to improve font workflow

Post 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?
When I write def I mean function.
Mystical
Prole
Posts: 7
Joined: Sun Mar 15, 2015 4:39 pm

Re: A suggestion to improve font workflow

Post 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.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: A suggestion to improve font workflow

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Mystical
Prole
Posts: 7
Joined: Sun Mar 15, 2015 4:39 pm

Re: A suggestion to improve font workflow

Post 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.
User avatar
airstruck
Party member
Posts: 650
Joined: Thu Jun 04, 2015 7:11 pm
Location: Not being time thief.

Re: A suggestion to improve font workflow

Post 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.
User avatar
arampl
Party member
Posts: 248
Joined: Mon Oct 20, 2014 3:26 pm

Re: A suggestion to improve font workflow

Post 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.
Mystical
Prole
Posts: 7
Joined: Sun Mar 15, 2015 4:39 pm

Re: A suggestion to improve font workflow

Post 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.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests