Text Object position on y-axis

I’m having the following problem: I noticed that when placing an object on-screen text that he has an offset top and bottom that prevents the placement sent by the designer

In the code example below I want to position the top of the text attached with the vertical line, but like you can see it not occured… the rectangle works like I expected

So I have painful work to fit the text manually as the specification of the designer

Can anyone help me with this?

[lua]display.setStatusBar( display.HiddenStatusBar )

HelveticaBold = “Helvetica-Bold”
Helvetica = “Helvetica”
local screenW, screenH = display.contentWidth, display.contentHeight
local centerW = screenW/2
local centerH = screenH/2

local main = function ()

local myCircle = display.newCircle( centerW, centerH, 5 )
myCircle:setFillColor(128,128,128)

local size = 100

local line1 = display.newLine( 0, screenH/2, screenW, screenH/2 )
line1:setColor( 255, 255, 255, 255 )
line1.width = 1

local line2 = display.newLine( screenW/2, 0, screenW/2, screenH )
line2:setColor( 100, 100, 100, 255 )
line2.width = 1

local text = display.newText(“aA”, 100, -5, HelveticaBold, size)

text:setReferencePoint(display.TopLeftReferencePoint)

text.x = centerW
text.y = centerH

local myRectangle = display.newRect(text.x, text.y, text.width, text.height)
myRectangle.alpha = 0.4

end

main()[/lua] [import]uid: 77276 topic_id: 15512 reply_id: 315512[/import]

The height of text objects measures the distance from ascent line to descent line (see http://www.dynamicgraphics.com/dgm/Article/28539/index.html), which basically accounts for the vertical space required by any character that might appear in the text object.

If you want to ignore the whitespace around your text, then you’ll either have to set the y position manually after you’ve figured it out through trial and error, or render all of your text as png images and display it that way (which is limiting if you’re setting text dynamically).

Off the top of my head, I’m not sure that there’s any way around your problem.

Darren [import]uid: 1294 topic_id: 15512 reply_id: 57308[/import]

I read the site and tried many combinations and none of them the letter get to ascent line

for me it doesn’t make a sense use the ascent line like a top reference for text objects

this behavior make my - developer - life too hard to work with a designer how consider just the Cap line to send to me the coordinates to develop the code
[import]uid: 77276 topic_id: 15512 reply_id: 57321[/import]

Now that I’m dealing with this, I see how crazy it is. Corona places the baseline of the type at the requested Y position + the full height of the font, from ascent to descent.

The font should be placed at its baseline. Or, somewhere measurable. Since we cannot find out the internal measurements, we can’t place fonts properly!

http://www.dynamicgraphics.com/dgm/Article/28539/index.html

This is crazy!
[import]uid: 37366 topic_id: 15512 reply_id: 115084[/import]