- Home /
How to access a Text Mesh Pro Font Asset's glyp info from c#?
I am writing a c# script that has custom formatting options and need access to the Font Asset Glyph Info of specified characters because I need to be able to find the width of a character. How can I access a glyph's width?
Answer by Yerendi · Mar 23, 2018 at 10:28 AM
I guess you found solution but I had this same problem and with Stephan's (who is TMP creator, you can use THIS thread to comunicate with him, his responses are great and fast) help I found solution.
TMP_Text textComponentReference;
charWidth = textComponentReference.font.characterDictionary[requestedChar].width * (textComponentReference.fontSize/textComponentReference.fontInfo.PointSize);
It considers your fontSize and does not required to populate Text component before calculations.
Your answer
Follow this Question
Related Questions
How to measure the width of a string? 0 Answers
TextMesh is not rendering Font correctly 0 Answers
Create a 3d text using c# (font problem) 2 Answers
Jagged and pixelated fonts in text mesh 3d (iphone) 4 Answers
Multiple Cars not working 1 Answer