Author Topic: preferredHeight/lineCount *slightly* off  (Read 513 times)

johnnemann

  • Newbie
  • *
  • Posts: 17
preferredHeight/lineCount *slightly* off
« on: September 17, 2018, 04:16:28 PM »
Hi,

I'm checking the height of lines of text in order to size their parent prefabs correctly. It mostly works great, however I've noticed that there are cases where I'll get a lineCount value of 1, although the text actually wraps. It seems to be cases where it's very close to the character limit for wrapping, or potentially where non-alphanumeric characters push it over the line. Two specific cases are: "It's not even 7 and you've already got *news*" and "...It's pretty nice having a clean slate for once"

Is this a known issue? I'm not on the latest TMP release, but I didn't see anything about this bug in release notes or anything so I wanted to check in before upgrading.

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5640
Re: preferredHeight/lineCount *slightly* off
« Reply #1 on: September 17, 2018, 10:37:34 PM »
Hi,

I'm checking the height of lines of text in order to size their parent prefabs correctly. It mostly works great, however I've noticed that there are cases where I'll get a lineCount value of 1, although the text actually wraps. It seems to be cases where it's very close to the character limit for wrapping, or potentially where non-alphanumeric characters push it over the line. Two specific cases are: "It's not even 7 and you've already got *news*" and "...It's pretty nice having a clean slate for once"

Is this a known issue? I'm not on the latest TMP release, but I didn't see anything about this bug in release notes or anything so I wanted to check in before upgrading.

I have addressed issues in the past related to preferred values being incorrect in some use / cases. There are no known outstanding ones at this point.

My suggestion would be to test this current case against the latest release and let me know if you still get the same result.

I'll test it on my end but most of the time, this is very dependent on the font asset, text container width and height, point size, character spacing, kerning, etc. so I may not be able to reproduce it without more specific details.

johnnemann

  • Newbie
  • *
  • Posts: 17
Re: preferredHeight/lineCount *slightly* off
« Reply #2 on: September 25, 2018, 08:31:13 AM »
Hi Stephan,

I upgraded and tested, and I'm still getting the same result, unfortunately.

What is the best way to work around this?

Stephan B.

  • Administrator
  • Hero Member
  • *****
  • Posts: 5640
Re: preferredHeight/lineCount *slightly* off
« Reply #3 on: September 25, 2018, 12:07:33 PM »
Hi Stephan,

I upgraded and tested, and I'm still getting the same result, unfortunately.

What is the best way to work around this?

Can you provide me with the text object setting that would enable me to reproduce the behavior?

An image showing the RectTransform settings, the text object setting, etc. Basically everything I need to reproduce this.