code: def splitLines0(frags, widths):
      
  
      #initialise the algorithm
      lineNum = 0
      maxW = widths[lineNum]
      i = -1
      l = len(frags)
      lim = start = 0
      text = frags[0]
      while 1:
          #find a non whitespace character
          while i < l:
              while start < lim and text[start] == ' ': start += 1
              if start == lim:
                  i += 1
                  if i == l: break
                  start = 0
                  f = frags[i]
                  text = f.text
                  lim = len(text)
              else:
                  break   # we found one
  
          if start == lim: break    # if we didn't find one we are done
  
          #start of a line
          g = (None, None, None)
          line = []
          cLen = 0
          nSpaces = 0
          while cLen < maxW:
              j = text.find(' ', start)
              if j < 0:
                  j == lim
              w = stringWidth(text[start:j], f.fontName, f.fontSize)
              cLen += w
              if cLen > maxW and line != []:
                  cLen = cLen - w
                  #this is the end of the line
                  while g.text[lim] == ' ':
                      lim -= 1
                      nSpaces -= 1
                  break
              if j < 0:
                  j = lim
              if g[0] is f:
                  g[2] = j  #extend
              else:
                  g = (f, start, j)
                  line.append(g)
              if j == lim:
                  i += 1
docs: given a list of ParaFrags we return a list of ParaLines
  
      each ParaLine has
      1)  ExtraSpace
      2)  blankCount
      3)  [textDefns....]
          each text definition is a (ParaFrag, start, limit) triplet