Issues with Auto size and tall special characters

Hi! Can anyone figure out what to do with TextMeshPro if players use special characters like Ⓛ that seem to be taller than normal characters? If I have Auto size enabled (as I want to handle longer texts better), other characters are shrunk because of that:

8125619--1053656--upload_2022-5-13_18-56-5.png

Is there some way make Auto size work so that it doesn’t shrink characters if normal-sized characters fit the vertical area, only if the width would become too much?

Auto-Size simply tries to fit all of the text within the given Text Container size.

For instance, if you were to use the <size=150%> markup tag on a single character, it would result in all of the text point size being reduce due to this single larger character.

In terms of potential ways to handle this, do you want to allow users to input those special characters? If not, you could filter those out from input. If yes, then you could limit the auto-size range.

P.S. Auto-size can have significant performance overhead where you should try to only use it to determine the optimum point size of text objects or groups of text objects which most of the time should only be done once when the screen size / resolution is determined or language changed.

See the following post and thread for more information.

In my example, the problem is that people are using those characters in their Steam profile names so just not showing them is not that nice either.

But yes, if there is no other solution I may have to rethink using auto size in those use cases, and maybe just use a fixed font size and truncate the text if it ends up being too long.

Are these special characters coming from your primary font asset or a fallback?

Regardless of where they are coming from, you could always edit the metrics of the fallback font asset to normalize them with the primary or even edit the metrics of the special characters to make sure they do not cause / impact auto-size.

In order to check these metrics, add a TMP_TextInfoDebugTool.cs script on a text component. This script is contained in the TMP Examples & Extras. I have made several posts about this tool which I use to visualize these metrics.

Yes the characters seem to be coming from a fallback. Not sure if it would happen otherwise, too, though, but it could explain the issue is the behavior is different in that case. That script seems quite complex so I am not sure yet if I really want to put it to every text field that would need it but I will investigate that later.

Thank you for the info anyway!

Most of the time, you only need to add this script on one text object to enable you to visualize the metrics of the primary font asset and fallbacks and to normalize them. Once done, you can remove the script from the object. Since these metrics adjustment are done on the font assets and not the text object, there is no need to repeat the process with other text object unless they are using different font assets.