Text placement bug ... err.. feature :-}

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
An00biS
Prole
Posts: 21
Joined: Thu Nov 13, 2008 9:55 am
Location: mapy.cz/?query=rajhrad

Text placement bug ... err.. feature :-}

Post by An00biS »

Hello.

I believe I've found a bug in LOVE's printf function - it behaves differently on Linux and Windows.

Here's the testing code:

Code: Select all

function love.draw()
   love.graphics.setColor(255,255,255,255);
   love.graphics.setLineStyle("rough");
   love.graphics.line(0,200,600,200)
   love.graphics.line(200,0,200,400)
   love.graphics.line(400,0,400,400)
   love.graphics.printf("X200 Y200 L200 center",200,200,200,"center");
end
Here's result on Windows XP, SP3:
text-pos-windowsXP.gif
text-pos-windowsXP.gif (3.66 KiB) Viewed 4808 times
Here's result on Fedora 13:
text-pos-Fedora13.gif
text-pos-Fedora13.gif (3.57 KiB) Viewed 4808 times
Does anybody here have the same problem?

~ An00biS

Edit: fixed thread title
Last edited by An00biS on Fri Sep 17, 2010 11:33 am, edited 1 time in total.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Text placement bug

Post by Robin »

I think you're using different versions -- starting 0.7, text is drawn top-left rather than bottom-left. You're using the PPA or something? my 666th post in S&D!
Last edited by Robin on Fri Sep 17, 2010 8:25 pm, edited 1 time in total.
Help us help you: attach a .love.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Text placement bug

Post by kikito »

Are you using exactly the same versions in windows and ubuntu?

I think I've read somewhere that the Ubuntu version using on the PPA had been updated, or something along those lines. On the new version, the text placement is corrected so it uses top-left coordinates, like everything else.

EDIT- woops, got ninja'ed by robin.
When I write def I mean function.
An00biS
Prole
Posts: 21
Joined: Thu Nov 13, 2008 9:55 am
Location: mapy.cz/?query=rajhrad

Re: Text placement bug

Post by An00biS »

I forgot to specify the versions :oops:

Windows - 0.6.2 stable download
Fedora - recent svn
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Text placement bug

Post by Jasoco »

Sometimes I wish I could draw text with the origin being the baseline. That is the bottom of the letters not counting the dangly parts. It could be useful in some situations. Does text have a way to retrieve the pixel height of the current font?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Text placement bug

Post by bartbes »

An00biS wrote:Windows - 0.6.2 stable download
Fedora - recent svn
Well, 0.6.2 had baseline drawing, and current hg (not svn, mind you!) has top-left, you observed well.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Text placement bug

Post by Jasoco »

If we could specify it optionally that would be neat. Can we in 0.7.0?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Text placement bug

Post by kikito »

Unless I'm missing something, you can add textheight to the y coordinate instead of having an additional method.

Code: Select all

 love.graphics.print(x,y+height,text) 
vs

Code: Select all

 love.graphics.setTextBaseline(true)
love.graphics.print(x,y,text)
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Text placement bug

Post by Robin »

kikito wrote:

Code: Select all

 love.graphics.setTextBaseline(true)
love.graphics.print(x,y,text)
Yuck. Do it either manually, as your first example, or add an extra parameter to love.graphics.print(), I'd say (the former has my preference, btw).
Help us help you: attach a .love.
An00biS
Prole
Posts: 21
Joined: Thu Nov 13, 2008 9:55 am
Location: mapy.cz/?query=rajhrad

Re: Text placement bug

Post by An00biS »

bartbes wrote:Well, 0.6.2 had baseline drawing, and current hg (not svn, mind you!) has top-left, you observed well.
:oops: :oops: :oops:
Post Reply

Who is online

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