Where are bases of elements? I mean where are x0 and y0?
Image and Animation have base in the center and method setCenter()
Where is in text?
I need to be able to do three things:
1. Count width of whole text line (works Font:getWidth( line ))
2. Count height of whole text line (Font:getHeight( )? Who knows.)
3. The most important and difficult to explain. I need to place text on position accordingly to it's width and height. To be concrete, I need to make rectangle as an envelope for the text and place it to the center of the envelope. But I need to do it dynamically. It's not possible with this unknown base.
I'd like to know how to count it in 0.3.2 and possibly some "get" "set" functions in the future.
I know, I always want more but, I believe that placing text precisely, e.g. to do text borders, is important for other people too.
Bases of Elements
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Citizen
- Posts: 94
- Joined: Thu Feb 21, 2008 1:11 am
Bases of Elements
>>I love LÖVE.<<
Re: Bases of Elements
This has bugged me too. Why is it at bottom left?
Re: Bases of Elements
Because that is how it was foretold by the gods of yore.
Actually, it's because I wrote the whole font rendering class by following what other people had done (and rude did some stuff too) and so I have no idea what's going on half the time. It's at the bottom left because that's how the FreeType tutorial I read decided to do it. Fret not, as one of the official tasks we have written down is actually "REDO FONT" because it needs to be awesome and not just a haphazard collection of code. This redoing is coming in a few years, so be patient.
Actually, it's because I wrote the whole font rendering class by following what other people had done (and rude did some stuff too) and so I have no idea what's going on half the time. It's at the bottom left because that's how the FreeType tutorial I read decided to do it. Fret not, as one of the official tasks we have written down is actually "REDO FONT" because it needs to be awesome and not just a haphazard collection of code. This redoing is coming in a few years, so be patient.
Now posting IN STEREO (where available)
-
- Citizen
- Posts: 94
- Joined: Thu Feb 21, 2008 1:11 am
Re: Bases of Elements
I don't expect anything else. I just want to know how I can count x0 y0 from it.mike wrote:This redoing is coming in a few years, so be patient.
Code: Select all
If not (you know how) then
post(".")
end
>>I love LÖVE.<<
Re: Bases of Elements
Oh we will just have to change all our code once you've donemike wrote:Because that is how it was foretold by the gods of yore.
Actually, it's because I wrote the whole font rendering class by following what other people had done (and rude did some stuff too) and so I have no idea what's going on half the time. It's at the bottom left because that's how the FreeType tutorial I read decided to do it. Fret not, as one of the official tasks we have written down is actually "REDO FONT" because it needs to be awesome and not just a haphazard collection of code. This redoing is coming in a few years, so be patient.
Re: Bases of Elements
Yeah, that is just retarded. I was a bit confused about the post, but let me ask you this:Jake wrote:Oh we will just have to change all our code once you've done
HOW DO YOU WANT IT TO WORK?
I can make some minor tweaks to the Fontage we have now, if so desired.
Now posting IN STEREO (where available)
Re: Bases of Elements
Well, SDL_ttf is reasonable with what it provides:
I've used SDL_ttf to create a GUI library and while it doesn't provide total control over positioning, it was more than enough to get what I wanted.
- Font height
- Font ascent
- Font descent
- Line skip
- Glyph metrics
- Size of text
- Render (creates a surface)
I've used SDL_ttf to create a GUI library and while it doesn't provide total control over positioning, it was more than enough to get what I wanted.
-
- Party member
- Posts: 101
- Joined: Mon Aug 11, 2008 5:19 am
Re: Bases of Elements
I'd like to see it work thusly:mike wrote:Yeah, that is just retarded. I was a bit confused about the post, but let me ask you this:Jake wrote:Oh we will just have to change all our code once you've done
HOW DO YOU WANT IT TO WORK?
I can make some minor tweaks to the Fontage we have now, if so desired.
love.draw("string", x, y [, font type] [,alignment] [,xmax])
The alignment would be center, left, or right. (x,y) would define the point on the center, left, or right side of the text respectively. "xmax" would be the furthest that text is allowed to extend before wrapping.
As far as vertical alignment, I believe that the bottom of the text is proper.
Is this the best way to put text on the screen? I couldn't say. But you asked what I wanted, so I mouthed off.
--Mr. Strange
Re: Bases of Elements
I hope you are aware of drawf:
love.graphics.drawf( string, x, y, limit, align )
limit = size of wrapper box
align = alignment of text in the wrapper box
So, here is the official question: shall X,Y point to the bottom left corner of the text or the top left or perhaps the center by default? Word your opinion here.
love.graphics.drawf( string, x, y, limit, align )
limit = size of wrapper box
align = alignment of text in the wrapper box
So, here is the official question: shall X,Y point to the bottom left corner of the text or the top left or perhaps the center by default? Word your opinion here.
Now posting IN STEREO (where available)
-
- Citizen
- Posts: 94
- Joined: Thu Feb 21, 2008 1:11 am
Re: Bases of Elements
Isn't solution. Still draws somewhere. I can't explain what I need.mike wrote:I hope you are aware of drawf:
love.graphics.drawf( string, x, y, limit, align )
Don't know don't care. In my opinion current base is the best for placing text on lines. As long as I'll be able to change the base, e.g. using something like getBaseX() getBaseY(), which would return current base coordinates from (I don't care which) corner, I'll be happy.mike wrote:So, here is the official question: shall X,Y point to the bottom left corner of the text or the top left or perhaps the center by default?
>>I love LÖVE.<<
Who is online
Users browsing this forum: Google [Bot] and 7 guests