code: def doLayout(self, width):
          
  
          # Calculate dimensions
          self.width = width
  
          font_sizes = [0] + [frag.get("fontSize", 0) for frag in self]
          self.fontSize = max(font_sizes)
          self.height = self.lineHeight = max(frag * self.LINEHEIGHT for frag in font_sizes)
  
          # Apply line height
          y = (self.lineHeight - self.fontSize) # / 2
          for frag in self:
              frag["y"] = y
  
          return self.height
docs: Align words in previous line.