   draw_finger_positions() if positions
   draw_closed_strings() if positions
 
-draw_intervals_from = (root_position, semitones, color) ->
-  root_note_number = pitch_number_for_position(root_position)
-  draw_finger_position root_position, is_root: true #, color: color
-  for position in intervals_from(root_position, semitones)
-    continue if position.string == root_position.string and position.fret == root_position.fret
-    draw_finger_position position, color: color
-
 
 #
 # Specific Cards and Pages

draw_fretboard_frets = ->
  style = FretboardStyle
  for fret in FretNumbers
    x = fret * style.fret_width + h_gutter
    ctx.beginPath()
    ctx.moveTo x, style.h_gutter
    ctx.lineTo x, style.h_gutter + (StringCount - 1) * style.string_spacing
    ctx.lineWidth = 3 if fret_number == 0
    ctx.stroke()
    ctx.lineWidth = 1

draw_fretboard_finger_position = ({string, fret}, options) ->
  {is_root, color} = options || {}
  style = FretboardStyle
  x = h_gutter + (fret - 1) * style.fret_width + style.fret_width / 2
  x = h_gutter if fret == 0
  ctx.beginPath()
  ctx.arc x, v_gutter + (6 - string) * style.string_spacing, 7, 0, 2 * Math.PI, false
  ctx.fillStyle = 'red'
  ctx.fillStyle = color or 'white' unless is_root
  ctx.lineWidth = 2 unless is_root
  ctx.fill()
  ctx.stroke()
  ctx.strokeStyle = 'black'
  ctx.lineWidth = 1


#
# Drawing Chord Diagrams
#

ChordDiagramStyle =

  ctx.fillStyle = 'white'
  ctx.fillRect 0, 0, canvas.width, canvas.height

draw_title = (text, {font, fillStyle, x, y, gravity}={}) ->
  gravity ||= ''
  ctx.font = font if font
  ctx.fillStyle = fillStyle if fillStyle
  m = ctx.measureText(text)
  # x -= m.width / 2
  y -= m.emHeightDescent if gravity.match(/^bottom$/)
  y += m.emHeightAscent if gravity.match(/^top|topLeft|topRight$/)
  ctx.fillText text, x or 0, y or 0

with_context = (ctx, fn) ->
  ctx.save()
