Do you mean the spacing is too much? I could do a quick spacing-fix, hang on...
Split all the characters of the string up and use a for loop and the surface library to get the height draw the char and increment the y poz
[QUOTE=MPan1;50495789]Do you mean the spacing is too much? I could do a quick spacing-fix, hang on...[/QUOTE]
Yes, compared to normal text, there's a lot of spacing between the characters with newlines
Try this:
[CODE]
function DrawVerticalText( text, font, x, y, col )
surface.SetFont( font )
surface.SetTextColor( col )
local prevh = 0 -- previous height
for i = 1, #text do
local w, h = surface.GetTextSize( string.sub( text, 1, i-1 ) )
prevh = prevh + h - 3 -- change the -3 to make the spacing bigger or smaller
surface.SetTextPos( x, y+prevh )
surface.DrawText( string.sub( text, i, i ) )
end
end
[/CODE]
It just splits the string up and draws a different character for each letter in the string, hopefully it'll do what you want it to
[editline]11th June 2016[/editline]
Lol, this does exactly what rtm516 says, sort of ninja'd
[editline]11th June 2016[/editline]
Also, if you wanted the text to be drawn centered on the x axis:
[CODE]
function DrawVerticalTextCentered( text, font, x, y, col )
surface.SetFont( font )
surface.SetTextColor( col )
local prevh = 0 -- previous height
for i = 1, #text do
local w, h = surface.GetTextSize( string.sub( text, 1, i-1 ) )
local actualw, actualh = surface.GetTextSize( string.sub( text, i, i ) )
prevh = prevh + h - 3 -- change the -3 to make the spacing bigger or smaller
surface.SetTextPos( x-actualw/2, y+prevh )
surface.DrawText( string.sub( text, i, i ) )
end
end
[/CODE]
Sorry, you need to Log In to post a reply to this thread.