Skip to content

Instantly share code, notes, and snippets.

@RemyPorter
Created July 10, 2014 19:03
Show Gist options
  • Save RemyPorter/5f8ab636c2cadb34119d to your computer and use it in GitHub Desktop.
Save RemyPorter/5f8ab636c2cadb34119d to your computer and use it in GitHub Desktop.
xindent = str(11.553572)
ystart = 894.94238
incr = 907.44238 - 894.94238
def lines(text):
words = text.split()
result = ""
currentLeg = ""
count = 0
for w in words:
if (len(currentLeg) + len(w) > 42):
count += 1
ystep = ystart + (incr * count)
result += '<tspan x="' + xindent + '" y="' + str(ystep) + '">' + currentLeg + '</tspan>'
currentLeg = ""
currentLeg += w + " "
count += 1
ystep = ystart + (incr * count)
result += '<tspan x="' + xindent + '" y="' + str(ystep) + '">' + currentLeg + '</tspan>'
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment