drawPositions() {
    const ctx = this.context;
    const x = this.getAbsoluteX();
    const ys = this.ys;
    for (let i = 0; i < this.positions.length; ++i) {
      const y = ys[i] + this.render_options.y_shift;
      const glyph = this.glyphs[i];

      // Center the fret text beneath the notation note head
      const note_glyph_width = this.glyph.getWidth();
      const tab_x = x + (note_glyph_width / 2) - (glyph.getWidth() / 2);

      // FIXME: Magic numbers.
      ctx.clearRect(tab_x - 2, y - 3, glyph.getWidth() + 4, 6);

      if (glyph.code) {
        Glyph.renderGlyph(ctx, tab_x, y,
          this.render_options.glyph_font_scale * this.render_options.scale,
          glyph.code);
      } else {
        ctx.save();
        ctx.setRawFont(this.render_options.font);
        const text = glyph.text.toString();
        ctx.fillText(text, tab_x, y + 5 * this.render_options.scale);
        ctx.restore();
      }
    }
  }
// Render the fret positions onto the context
Render the fret positions onto the context
Render the fret positions onto the context
drawPositions() {
    const ctx = this.context;
    const x = this.getAbsoluteX();
    const ys = this.ys;
    for (let i = 0; i < this.positions.length; ++i) {
      const y = ys[i] + this.render_options.y_shift;
      const glyph = this.glyphs[i];
      const note_glyph_width = this.glyph.getWidth();
      const tab_x = x + (note_glyph_width / 2) - (glyph.getWidth() / 2);
      ctx.clearRect(tab_x - 2, y - 3, glyph.getWidth() + 4, 6);
      if (glyph.code) {
        Glyph.renderGlyph(ctx, tab_x, y,
          this.render_options.glyph_font_scale * this.render_options.scale,
          glyph.code);
      } else {
        ctx.save();
        ctx.setRawFont(this.render_options.font);
        const text = glyph.text.toString();
        ctx.fillText(text, tab_x, y + 5 * this.render_options.scale);
        ctx.restore();
      }
    }
  }
drawPositions ( ) { const ctx = this . context ; const x = this . getAbsoluteX ( ) ; const ys = this . ys ; for ( let i = 0 ; i < this . positions . length ; ++ i ) { const y = ys [ i ] + this . render_options . y_shift ; const glyph = this . glyphs [ i ] ; const note_glyph_width = this . glyph . getWidth ( ) ; const tab_x = x + ( note_glyph_width / 2 ) - ( glyph . getWidth ( ) / 2 ) ; ctx . clearRect ( tab_x - 2 , y - 3 , glyph . getWidth ( ) + 4 , 6 ) ; if ( glyph . code ) { Glyph . renderGlyph ( ctx , tab_x , y , this . render_options . glyph_font_scale * this . render_options . scale , glyph . code ) ; } else { ctx . save ( ) ; ctx . setRawFont ( this . render_options . font ) ; const text = glyph . text . toString ( ) ; ctx . fillText ( text , tab_x , y + 5 * this . render_options . scale ) ; ctx . restore ( ) ; } } }
Render the fret positions onto the context
Render the fret positions onto the context
// Center the fret text beneath the notation note head // FIXME: Magic numbers.