     ctx.moveTo h_gutter, y
     ctx.lineTo h_gutter + fret_count * fret_width + fret_overhang, y
     ctx.lineWidth = 1
-    ctx.lineWidth = 0.5 if hidden_strings.indexOf(n) >= 0
     ctx.stroke()
 
 draw_frets = ->

      ctx.stroke()
      ctx.lineWidth = 1

  draw_note = (string_number, fret_number, root, color) ->
    y = v_gutter + (fret_number - 1) * fret_height + fret_height / 2
    ctx.fillStyle = color or (if root then 'red' else 'white')
    ctx.strokeStyle = color or 'black'
    ctx.lineWidth = 1
    ctx.beginPath()
    ctx.arc h_gutter + (6 - string_number) * string_spacing, y, note_radius, 0, 2 * Math.PI, false
    ctx.fill() if fret_number
    ctx.stroke()
    ctx.strokeStyle = 'black'


draw_fingerboard = (fingerings) ->
  draw_strings()
  draw_frets()
  if fingerings
    fretted_strings = (false for _ in [0..string_number])
    for {string, fret, root, color} in fingerings
      fretted_strings[string] = true
      draw_note string, fret, root, color
    for is_fretted, string_number in fretted_strings
      continue if is_fretted or string_number < 1
      ctx.font = '4pt Helvetica'
      ctx.fillStyle = 'black'
      ctx.fillText "x", h_gutter + (6 - string_number) * string_spacing - 1, v_gutter - 2.5


note_number_at = (string, fret) ->
  string_note_numbers[string - 1] + fret

fingerings_each = (fn) ->
  for string in strings
    for fret in frets
      fn string, fret

save_canvas_to_png = (canvas, fname) ->
  out = fs.createWriteStream(build_directory + fname)

    diagram_gutter = 10

  pitch_fingers = []
  finger_positions_each (fingering) ->
    pitch_number = fingering_note_number(fingering) % 12
    pitch_fingers[pitch_number] = fingering

  colors = ['red', 'blue', 'green', 'orange']
  other_colors = ['rgba(255,0,0 ,.1)', 'rgba(0,0,255, 0.1)', 'rgba(0,255,0, 0.1)', 'rgba(255,0,255, 0.1)']

  grid cols, rows, padded_fretboard_width + diagram_gutter, padded_fretboard_height + diagram_gutter, diagram_title_height, (cell) ->
    ctx.font = '20px Impact'
    ctx.fillStyle = 'rgb(128, 128, 128)'
    ctx.fillText "#{chord.name} Chords", diagram_gutter / 2, header_height / 2

    for ix in [0...12]
      pitch_number = (ix * 5 + 7) % 12
      root_fingering = pitch_fingers[pitch_number]
      cell ->
        ctx.font = '20px Impact'
        ctx.font = '5pt Times' if draw_diagrams
        ctx.fillStyle = 'rgb(10,20,30)'
        ctx.fillText "#{NoteNames[pitch_number]}#{chord.abbr}", h_gutter, -3
        fingerings = []
        for semitones, si in chord.offsets
          for {string, fret} in intervals_from(root_fingering, semitones)
            fingerings.push {string, fret, color: colors[si]}
        draw_fingerboard fingerings

book = (filename, draw_book) ->
  pdf = true
