- Home /
TextArea tab width
Hello,
I can use EditorGUILayout.TextArea or GUILayout.TextArea in an editor window I am making. The user needs to be able to use tabs (for indentations in code they are editing). The problem is the default width of empty space produced from hitting the tab key, looks too wide (it might partly depend on the font) so I would like to make it smaller.
I can't seem to find any documentation to do help with this relating to the TextArea method or the GUIStyle provided. The best solution I currently have is to replace any tabs in the string with a few whitespace characters (but then you have lots more characters which get in the way).
Is there a way of doing this without having to replace tab with spaces?
Thank you
I've done some more research and I think there might be a solution by creating a new Font asset by code and copying all the characterInfo across to the new font. The documentation suggests this information can be set by code.
Then using the variables on this page there might be a way to change the width of the 'tab' character if it is in this list.
If I manage to work out exactly how to do it, I will post it as an answer.
I went down this road in vain. The \t character is for some reason not on the list. $$anonymous$$entioned here https://stackoverflow.com/a/48697029/1148434