 
   return chunks.map (c) -> c.trim()
 
-formatForTextBubble = (msg, font="./ayp-template-images/arial.ttf", size=12, max=330) ->
+formatForTextBubble = (msg, font, size, max) ->
   msg = msg.trim()
   [w, h] = textSize(msg, font, size)
   if w > max

  else
    msg

textBubble = (msg, font="./ayp-template-images/arial.ttf", size=12, max=330) ->
  msg = formatForTextBubble(arguments...)
  [w, h] = textSize(msg, font, size)

  frame = GD.createTrueColor(w, h)


# The ammount of padding on each side of a panel
AYP_PANEL_PADDING = 6

# Space left between stacked speech bubbles
# and the sides of the panel and the speech bubbles
AYP_BUBBLE_PADDING_VERTICAL   = 3
AYP_BUBBLE_PADDING_HORIZONTAL = 3

# Maximum width of the speech bubble, after text becomes wider
# it is wrapped to a new line
AYP_BUBBLE_MAX_WIDTH          = AYP_PANEL_WIDTH - 18


## Paths to find media
