ID:160524
 
Im currently making an onscreen text system (well using a library to learn how and then making mine to fit my needs). Ive figured out how to display the text and it works fine, but now i would like to add a couple things to make it look nicer.

1. (not really important but would be nice) Make it so each letter has its own space so the text has better spacing...for example the "i" would be closer and wouldnt have a huge gap. I only have one object for all the text and using different icon states so i cant figure a way to change the spacing based on the icon state without writing a huge amount of if statements.

2. (The real reason for the post) I want to be able to wordwrap the text. I know i can just go through and space my input so it is right but thats just a lot of senseless work when i can code something to do it for me. I have the text string entered into a list with each variable like so

TextConverter(var/text)
text1=list()
for(var/a=1,a<=length(text),a++)
text1+=copytext(text,a,a+1)

I would be able to do it if i could check how many letters the next word after a space is
As far as I know, sorry if I'm wrong, word wrapping is usually used to wrap text around an image, correct? If I'm right, then you're getting into a very complicated scenario.

Spacing would be much easier. You could use letter datums to decide the spacing between each letter, or an associative list. I would recommend the latter unless you want to have even more specific control over each letter.
In response to Jeff8500
wordwrap is just taking a word that is at the end of the line and instead of breaking the word and putting half on one line and half on the next it puts the entire word on the next line
In response to NightJumper88
Now that is complicated.. What you could do, is break lines manually. Use the _ (underscore, since it's very unlikely you'll use it as on screen text) as a break line character, and on the ScreenText() proc, check to see if you should break lines:

var/checkbreak=copytext(T,2)
if(checkbreak=="_")
// beak line

That's the best way I know there might be others o.o
The first request would remove the constant size that you were planning on taking advantage of in your second request.

That said, Hiead offered a word-wrapping proc in Jtgibson's Snippets Database that you might want to look at.