🤑 Indie game store🙌 Free games😂 Fun games😨 Horror games
👷 Game development🎨 Assets📚 Comics
🎉 Sales🎁 Bundles

Monospace fonts are not rendering as monospaced when centered

A topic by SpacemanStrife created 29 days ago Views: 46 Replies: 4
Viewing posts 1 to 5
(Edited 3 times)

In my current project, I'm using a monospace font for UI counters so that the numbers don't jitter around when they change, but Super Text Mesh ignores this and does not evenly space them when the text alignment is set to Centered. This does not happen with Unity's default Text Mesh object, nor does it happen when alignment is Left, Right, or Justified. Is this a bug or is there a way for me to adjust this?


Hmm... I'm having trouble reproducing this, could you post a screenshot of your editor window, including STM's inspector?

I uploaded a .gif here:


To be more specific, what's happening is that the text is re-centering itself when the numbers change. I've tried it with different monospace fonts so it's not just the font I'm currently using. I'm also using Unity 5.6.3f.


Okay yep, I'm able to repro it now. (I'm testing this with courier btw. Top mesh here is STM, bottom is UGUI)

I think this is caused by... the middle alignment only takes the width of the letter into account, not the width + advance. When I right-align a UGUI Text component, the text is not flush with the right side of the box, but with STM it is. This is a great catch, but I'm worried about changing this, since it would effect all text meshes, not just monospace fonts. I'll have to come up with a way for this behaviour to only effect monospace fonts automatically, somehow.

I'll write this down for sure, but if you align stuff to the left, it should work for your purposes for now?

Yeah, I can "solve" the problem by aligning to the left and then moving the text box so that it's center.

Anyway, that's fascinating info! I'm not overly code-savvy so I don't know how practical it would be to pull off, but perhaps the issue can be solved without introducing problems by adding a monospacing feature in the future? Like, maybe STM could be set to render a letter every X distance regardless of its actual width, effectively allowing any font to be monospaced.

Thanks for the fast reply! Disregarding this hiccup, I'm having a great time with this plugin.