What I have achieved is a function that replaces certain syntax with strings (character names for example). That same function and syntax should also be able to change the color of the text, which it can, but is for some reason incompatible with \n.
Whenever i use \n and later change the color it behaves weirdly to say the least, it continues on the first line whenever the color is added.
I keep track on where the text is with a combination of three variables: ix, iy and font:getWidth()
Whenever it should go to the next line (which is detected by an empty string or "\n") I do:
Code: Select all
ix, iy = 0, iy+global.fontHeight
Code: Select all
local width = font:getWidth(string)
ix = ix+width
It feels like the code isn't obeying me... it should and probably is, but it doesn't feel like it.