   # Public: Measures text.
   #
   # text - text to measure
-  # size - text size (default: font size)
-  # line_spacing - desired line spacing (default: 2 * size)
-  # word_spacing - desired word spacing (default: size)
   #
   # Returns a {Fz2D.Rect}.
-  measureText: (text, size=@size, line_spacing=size+size, word_spacing=size) ->
+  measureText: (text) ->
     w = 0
     h = 0
     maxWidth = 0

  # text - text to measure
  # x - position on the X axis
  # y - position on the Y axis
  # size - text size (default: font size)
  # line_spacing - desired line spacing (default: 2 * size)
  # word_spacing - desired word spacing (default: size)
  #
  # Returns a last position.
  drawText: (ctx, text, x, y, size=@size, line_spacing=size+size, word_spacing=size) ->
    xx = x
    yy = y

    for c in text
      switch c
        when ' '
          xx += word_spacing
          continue
        when '\n'
          xx = x
          yy += line_spacing
          continue
        when '\t'
          xx += 3 * word_spacing
          continue
 
      char = @chars[c] || @invalid_char

      ctx.draw(@texture, char.x, char.y, char.w, char.h, xx, yy, size, size)

      xx += size

    xx

    for c in text
      switch c
        when ' '
          w += @size
          continue
        when '\n'
          maxWidth = w if w > maxWidth
          w = 0
          h += @linesize
          continue
        when '\t'
          w += @tabsize
          continue

      char = @chars[c] || @invalid_char

      w += char.w

    if w > 0 and maxWidth == 0
      maxWidth = w

    if maxWidth > 0 and h == 0
      h = @size

    new Fz2D.Rect(0, 0, maxWidth, h)

