Flash has a 2 pixel gutter all around the text.  Is that throwing off your 
calculations?

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf 
Of carloscarvalhar
Sent: Friday, March 27, 2009 10:49 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] mx:Text and line height


Hi,

how can i get a correct line heigth of mx:Text?

This is code that i'm using:
public function get textLineHeight():uint {
var textLineMetrics:TextLineMetrics = this.getLineMetrics(0);
_textLineHeight = textLineMetrics.height + textLineMetrics.leading;
return _textLineHeight;
}

And the result is strange...if i have only one line, i need to add 3 pixels, if 
i have two lines, it's ok. But if i have more than 2 lines the height returned 
is bigger than it should be...

what am i doing wrong? how should i get a REAL line height?

Thanks,
Carlos
PS: you can see it happening here:
http://carvalhar.com/#/blog/45/incorporando-fontes-no-flex/

Reply via email to