- Home /
How can I adjust line spacing for a font?
How can I adjust line spacing for a font? It is greyed out in the Font info
When I use word wrap, the lines are too far apart on most fonts. In 3DS Max, we can adjust both kerning and spacing for whatever font we choose.
Is there a way to do it in Unity or did they just show the parameters and grey them out to torture us?
:)
thanks
Did you ever find a solution? I've hit the same restriction on line height, on all GUI elements! No Line Height parameter to set anywhere in the inspector.
Answer by qJake · Jul 18, 2010 at 06:17 PM
You need to use GUIStyles/GUISkins.
http://unity3d.com/support/documentation/ScriptReference/GUIStyle-lineHeight.html
GUIStyles have support for custom line heights.
Read about GUI Styles here:
http://unity3d.com/support/documentation/Components/class-GUIStyle.html
It shouldn't be read-only when you set the GUI Style via the Inspector (using a GUI skin).
But it is, I just tried it. - Still: If I'm wrong feel free to correct me. I myself find it pretty strange that we are not able to change informations like kerning and line spacing even though a font actually seems to support it in a way.
In case you are looking for a general solution: the add on Text$$anonymous$$esh pro does expose this per font directly in the Unity UI, and also expose line (and character & paragraph spacing) per objects.
Answer by pyro · Jul 18, 2010 at 09:49 PM
The kerning value you see grayed out is only for use by custom fonts. You can't really control the auto-imported Unity ones very well.
Answer by AltIvan · Aug 25, 2014 at 08:11 PM
You can change the spacing or the kerning if you create a editable copy of the font, you just have to click in the font (in the Assets panel), go to the gear icon of the Inspector panel and click "Create Editable Copy". The new copy on the Assets panel has a parameter called "Line Spacing" that you can modify at will.
Your answer
Follow this Question
Related Questions
Is there a way to measure the pixel with/height of a string with a given font? 2 Answers
How to find a font via script? 2 Answers
Unity 3.0 Font support 1 Answer
Change string for sprite 0 Answers