I'm having some trouble with the sizing TextMesh objects.
Specifically, the meaning of characterSize seems to change with the fontSize.
Fonts created with a larger fontSize are larger for the same value of characterSize as fonts created with a smaller fontSize. If you have a dynamic font, then a charSize of 16 and a fontSize of 8 is the same as a charSize of 8 and a fontSize of 16.
The problem is, there is no way in the script interface of finding out the fontSize, so even if I figure out the relationship and how to make my font a given number of units tall, I have no way to calculate the correct values in script. (without telling the artists, all fonts should have a fontSize of n).
Does anybody have any insight? Should I just roll my own text system? (I have a text system from our previous games that works pretty well, but I'd prefer to use the inbuilt Unity one if at all possible)
asked Mar 30 '11 at 06:40 PM
OK it turns out that by the wonders of hidden magic numbers, here is how to work out characterSize for a given fontSize and target size in world units:
characterSize = targetSizeInWorldUnits*10.0f/fontSize;
Of course, you can't actually read fontSize from the font in any way shape or form.
But that's how to do it.
answered Mar 30 '11 at 07:23 PM
Font size effectively changes the resolution of the font. Turn your font size super small, and your character size super big, and your text will look like crap. Do the opposite, and you'll have very nice, smooth letters.
TextMeshes have numerous flaws though with their general operation, and there's not really anything they can do that a GUIText can't do better (unless you specifically need text to follow objects around in the 3D world).
answered Mar 30 '11 at 06:43 PM