newImageFont, letter spacing

General discussion about LÖVE, Lua, game development, puns, and unicorns.
tomshreds
Party member
Posts: 101
Joined: Thu Oct 18, 2012 8:49 pm

newImageFont, letter spacing

Post by tomshreds »

Hi,

I was wondering if it would be possible to get a bit less letter spacing when using newImageFont ?

Image

Thanks!
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: newImageFont, letter spacing

Post by Nixola »

I didn't get so much spacing the last time I used one, could you upload the image so we can see if there's something wrong in it? If I recall well, Imagefonts have a default spacing of 1 which gets added to the actual space between the glyphs inside the image (except for the separator coloumn, which is not considered)

EDIT: Now that I read my post again, I could have said that the separator coloumn IS considered and there's no added spacing... Nevermind, it's about the same, isn't it?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
tomshreds
Party member
Posts: 101
Joined: Thu Oct 18, 2012 8:49 pm

Re: newImageFont, letter spacing

Post by tomshreds »

Nixola wrote:I didn't get so much spacing the last time I used one, could you upload the image so we can see if there's something wrong in it? If I recall well, Imagefonts have a default spacing of 1 which gets added to the actual space between the glyphs inside the image (except for the separator coloumn, which is not considered)

EDIT: Now that I read my post again, I could have said that the separator coloumn IS considered and there's no added spacing... Nevermind, it's about the same, isn't it?
Haha, Here's the bitmap font file:
download/file.php?mode=view&id=22824

Maybe it's the spacing IN that file?

Thanks!
Attachments
T7GdNUa.png
T7GdNUa.png (1.84 KiB) Viewed 356 times
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: newImageFont, letter spacing

Post by Nixola »

The yellow coloumns should be only 1px wide, otherwise you get increased spacing (Actually I'd have said it would have just messed up something, but it doesn't seem like it's that)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
tomshreds
Party member
Posts: 101
Joined: Thu Oct 18, 2012 8:49 pm

Re: newImageFont, letter spacing

Post by tomshreds »

Nixola wrote:The yellow coloumns should be only 1px wide, otherwise you get increased spacing (Actually I'd have said it would have just messed up something, but it doesn't seem like it's that)
Ah! Alright! I'll try to change it and will try again. Thanks a lot!
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: newImageFont, letter spacing

Post by Nixola »

You're welcome ;)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
xaa3
Prole
Posts: 14
Joined: Sat Aug 31, 2013 12:36 am

Re: newImageFont, letter spacing

Post by xaa3 »

Is it possible to remove the spaces in between characters completely? I'm trying to use pixel fonts to make health bars but the spaces makes it look wrong.

Posted a pic of what I'm going for.
Attachments
healthbars.png
healthbars.png (1.22 KiB) Viewed 4615 times
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: newImageFont, letter spacing

Post by Jasoco »

The problem is that image fonts don't have letter spacing at all. Let alone negative spacing. I wish they did though. It'd be so useful. Especially to replicate a lot of fonts from the SNES era which had black borders that overlapped. The way it is now you'd have to write your own text display system or a shader to add the border which is overkill. Has anyone suggested it to the Issue Tracker yet? Seems like it'd be easy to implement unless the text display library Löve uses has a limitation.

And in reply to xaa3 above, why not just use images or rectangles?
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: newImageFont, letter spacing

Post by slime »

In LÖVE 0.10.0, the special coloured spacing pixels in ImageFonts will be ignored completely for character spacing calculations.
Using a font isn't an optimal way to create a health bar either way though, you could just use two overlaid rectangles or images as Jasoco says.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: newImageFont, letter spacing

Post by Jasoco »

But will we be able to set the letter spacing on image fonts in 0.10.0? And also, why 0.10.0 and not 0.9.3 too? Isn't 0.10.0 really really far off?
Post Reply

Who is online

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