- Home /
Text Mesh Pro line spacing
I need a text interspersed with sprites, for a table. So, the spacing between lines must be the height of the Sprite. But both sprite size and the font size must be customizable, and I cant figure on what I must base the lineSpacing value.
For example (The one shown in the picture), Font Size = 20, SpriteHeight = 3 and the only spacing that works is 0.007.
(The blue lines are the sprites)
I need some sort of function that outputs the scaled margin, so I can use on the Text Mesh Pro. Some examples I got experimentally:
FontSize=10, SpriteHeight=3 expected output --> 12.908
FontSize=20, SpriteHeight=3 expected output --> 0.007
FontSize=20, SpriteHeight=6 expected output --> 0.008
FontSize=10, SpriteHeight=6 expected output --> 38.71
Can someone explain me the math? Thanks in advance!
As I couldnt solve this, I used a binary search algorithm to find a matching value
Answer by nakkalokesh99 · Mar 04, 2021 at 04:19 PM
did you find any solution. i have similar problem
Unfortunaly no... I had to totally change my design, to a column with a vertical gridlayougroup and multiple child gameobjects, each with an image and Text.
Your answer
