Support => NGUI 3 Support => Topic started by: vallcrist on December 18, 2013, 12:45:33 PM
Title: UITextList not accounting for font spcaing
Post by: vallcrist on December 18, 2013, 12:45:33 PM
UITextList does not account for vertical spacing in the fonts, so if you have a 200 px height textbox with a 12px height font and 4 px of vertical spacing it will try to fit 16 lines ( 200/12 ) when it only fits 12 ( 200 / (12+4) )
Title: Re: UITextList not accounting for font spcaing
Post by: ArenMook on December 18, 2013, 12:48:19 PM
Thanks, you can resolve this by changing UITextList.lineHeight property to the following:
Title: Re: UITextList not accounting for font spcaing
Post by: vallcrist on January 20, 2014, 04:44:48 PM
Hey Michael, just stumbled on this error again today as i was redoing the chat in our game, seems like you forgot to add the in the updates, just bumping this up so you see it again. :)
You did update the lineHeight property, but you forgot to change it in the UpdateVisibleText method.
Line 299 of UITextList
int maxLines = Mathf.FloorToInt((float)textLabel.height/ textLabel.fontSize);
should be
int maxLines = Mathf.FloorToInt((float)textLabel.height/ lineHeight);
Title: Re: UITextList not accounting for font spcaing
Post by: ArenMook on January 21, 2014, 01:23:39 AM
You're right, thanks -- but you should also modify 'scrollHeight' too.
protectedint scrollHeight
{
get
{
if(!isValid)return0;
int maxLines = Mathf.FloorToInt((float)textLabel.height/ lineHeight);