Text Origin Decide-icidal

General discussion about LÖVE, Lua, game development, puns, and unicorns.

The text origin should be:

Poll ended at Fri Sep 25, 2009 8:43 pm

Top-left
20
100%
Baseline
0
No votes
 
Total votes: 20

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Text Origin Decide-icidal

Post by Robin » Sun Sep 20, 2009 6:44 am

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. ;)
Help us help you: attach a .love.

User avatar
zugamifk
Prole
Posts: 28
Joined: Sun Jul 26, 2009 4:01 pm

Re: Text Origin Decide-icidal

Post by zugamifk » Sun Sep 20, 2009 8:44 am

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?

User avatar
rude
Administrator
Posts: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Text Origin Decide-icidal

Post by rude » Sun Sep 20, 2009 10:16 am

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.

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Text Origin Decide-icidal

Post by Robin » Sun Sep 20, 2009 10:30 am

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.
Help us help you: attach a .love.

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Text Origin Decide-icidal

Post by bartbes » Sun Sep 20, 2009 10:39 am

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.

User avatar
rude
Administrator
Posts: 1051
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Text Origin Decide-icidal

Post by rude » Sun Sep 20, 2009 10:44 am

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.

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Text Origin Decide-icidal

Post by Robin » Sun Sep 20, 2009 10:47 am

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 :P
edit: now I have 555 posts :neko:
Help us help you: attach a .love.

User avatar
Jasoco
Inner party member
Posts: 3651
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Text Origin Decide-icidal

Post by Jasoco » Sun Sep 20, 2009 4:23 pm

Okay, who's the one being different up there?

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Text Origin Decide-icidal

Post by Robin » Sun Sep 20, 2009 4:36 pm

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)
Help us help you: attach a .love.

User avatar
Simtex
Prole
Posts: 39
Joined: Sun Dec 14, 2008 5:31 am

Re: Text Origin Decide-icidal

Post by Simtex » Sun Sep 20, 2009 9:03 pm

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:

Image

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.

Post Reply

Who is online

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