From 838ac1c85c9be63310f55fc3608bb7450798019d Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Mon, 27 Jan 2014 07:41:00 -0500 Subject: [PATCH] Fix text width being calculated incorrectly in certain situations --- objects/text.lua | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/objects/text.lua b/objects/text.lua index b6e4e07..0de96af 100644 --- a/objects/text.lua +++ b/objects/text.lua @@ -389,27 +389,23 @@ function newobject:SetText(t) v.x = drawx v.y = drawy else - if k ~= 1 then - if string.byte(text) == 10 then - twidth = 0 - drawx = 0 - width = 0 - drawy = drawy + largestheight - largestheight = 0 - text = "" - if lastwidth < textwidth then - lastwidth = textwidth - end - if largestwidth < textwidth then - largestwidth = textwidth - end - textwidth = 0 - else - drawx = drawx + prevtextwidth - textwidth = textwidth + width + if string.byte(text) == 10 then + twidth = 0 + drawx = 0 + width = 0 + drawy = drawy + largestheight + largestheight = 0 + text = "" + if lastwidth < textwidth then + lastwidth = textwidth end + if largestwidth < textwidth then + largestwidth = textwidth + end + textwidth = 0 else - initialwidth = width + drawx = drawx + prevtextwidth + textwidth = textwidth + width end prevtextwidth = width prevtextheight = height @@ -424,7 +420,7 @@ function newobject:SetText(t) end if textwidth < largestwidth then - textwidth = largestwidth + initialwidth + textwidth = largestwidth end if maxw > 0 then