A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'UGUI & TextMesh Pro' started by TomTheMan59, May 16, 2022.
Is this a known issue? The monospace isn't making the spacing between these characters even.
Monospacing doesn't make the spacing between characters even, if makes the spacing of each character even.
Below is an example where I am using "<mspace=20>0.00" where it doesn't seem like the characters are evenly spaced.
However, if I draw rectangles of identical size around each character, we can see they are in fact correctly and evenly spaced.
Note that each character is centered in the given space which in this example is 20 units.
Dang! I am trying to get my timer to stop jiggling and someone suggested doing this.
Is there anyway to stop the font from jiggling as it counts up? It isn't a monospaced font and the only solution is to set it to align upper-left but that doesn't keep it centered in its container.
I tried centering the text every frame by measuring its length, but that also causes jiggling.
Another solution was to break up the seconds and milliseconds into two different labels but that doesn't work as the period can be overlapped.
Is there anyway to fix this issue easily?
@Stephan_B Is there any workaround?
Using the <mspace=x> markup tag should work.
This is what I did in the OP and you explained why it doesn’t work. I am very confused ?
You can see the spacing between the period is the issue.
When using Monospace and depending on the font, the spacing can look weird but you should be able to tweak the <mspace=x> value to get a decent result and when doing so, the digits / glyphs will be stable.
I cant get the digits/glyphs to be stable.
Is there something I am missing?
I just surrounded my text with <mspace=0.65em> and it mostly works but not really. It jiggles around a little.
Is the entire block of text enclosed in this <mspace=x> markup tag or just some portion of the text?
Thanks for chasing up!
In the example above it was single UGUI TMP component with a portion surrounded by tags. ie:
But I've since split it up into two separate UGUI TMP objects (positioned using a horizontal layout group) and swapped out for a true monospace font. The true monospace font works fine, and the old font still doesnt work. So, to be clear, this is two separate TMP components:
One just says 'Miles' (no mspace tags)
the other one is the number and the entire thing is surrounded by mspace tag