Page 2 of 3
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 6:44 am
by Robin
Jasoco wrote:I don't have to depend on the OS having the font installed
"Normal" fonts are usually not system dependent either, as we package them in the .loves. 8-) There was a whole debate over allowing to use sytem fonts a while back, but I can't remember what the exact outcome was... IIRC, it was possible (if you stick to well-defined font names), but you needed to add that ability in the source of LÖVE.
Of course, all the other reasons you gave for image fonts are still valid.
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 8:44 am
by zugamifk
Ah nuts, I voted the wrong thing. Just make my vote for top left.
I wonder though, why have it set to baseline in the first place? Is there a benefit to that?
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 10:16 am
by rude
I don't think we ever made that choice actively. Mike just adapted some code from NeHe, and it used baseline. I'm trying to think if any problems can arise by making it top left, i.e. if there is a reason
people use baseline.
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 10:30 am
by Robin
rude wrote:I'm trying to think if any problems can arise by making it top left, i.e. if there is a reason
people use baseline.
I'm just guessing here, but maybe it's because different characters have different heights? So if we were to draw two strings next to each other, but the one has an "f", while the other only has an "a", they would be misaligned if the origin is top-left. I don't know whether this makes any sense or not.
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 10:39 am
by bartbes
It does, so basically, it has to be compensated to not draw from top-left of the character, but top-left of the 'font'. And, of course, baseline is how people write.
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 10:44 am
by rude
If that's the only reason then I think it's no problem.
But keep thinking. 8-)
zugamifk: you should be able to change your vote now.
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 10:47 am
by Robin
rude wrote:If that's the only reason then I think it's no problem.
But keep thinking. 8-)
zugamifk: you should be able to change your vote now.
Congratulations with your 888 posts
edit: now I have 555 posts
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 4:23 pm
by Jasoco
Okay, who's the one being different up there?
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 4:36 pm
by Robin
Jasoco wrote:Okay, who's the one being different up there?
zugamifk wrote:Ah nuts, I voted the wrong thing. Just make my vote for top left.
8-)
(although he might have changed his vote already, but I don't think so)
Re: Text Origin Decide-icidal
Posted: Sun Sep 20, 2009 9:03 pm
by Simtex
Robin wrote:I'm just guessing here, but maybe it's because different characters have different heights? So if we were to draw two strings next to each other, but the one has an "f", while the other only has an "a", they would be misaligned if the origin is top-left. I don't know whether this makes any sense or not.
This is what I thought too, but I kept running into problems, for instance:
(the following is done in Love 0.6 with image x,y defaulting to the upper left, but the same behavior appears in 0.5)
Code: Select all
testImage = love.graphics.newImage("button.png")
testFont = love.graphics.newFont(love._vera_ttf, 18)
testText = "play"
love.graphics.setFont(testFont)
imageX = 400
imageY = 300
imageCenterX = imageX + (testImage:getWidth() / 2)
imageCenterY = imageY + (testImage:getHeight() / 2)
textX = imageCenterX - (testFont:getWidth(testText) / 2)
textY = imageCenterY + (testFont:getHeight() / 2)
love.graphics.draw(testImage, imageX, imageY)
love.graphics.print(testText, textX, textY)
The results:
Notice that the 'p' and 'y' extend below the other letters, while the 'l' rises higher than the other letters, yet even the 'l' is too low. Along the x-axis though, everything is properly centered.