function drawGlyph(ctx, glyph) {
  /** @type {(pt: {x: number, y: number, on: boolean}) => [number, number]} */
  const xy = pt => [ pt.x, pt.y ];
  ctx.beginPath();
  for (const contour of glyph) {
    ctx.moveTo(contour[0].x, contour[0].y);
    let i = 0;
    while (i < contour.length - 1) {
      if (!contour[i].on) throw Error('Invalid cubic bezier.');
      if (!contour[i + 1].on) {
        const endPt = xy(i+3 < contour.length ? contour[i+3] : contour[0]);
        ctx.bezierCurveTo(...xy(contour[i+1]), ...xy(contour[i+2]), ...endPt);
        i += 3;
      } else {
        const endPt = xy(i+1 < contour.length ? contour[i+1] : contour[0]);
        ctx.lineTo(...endPt);
        i++;
      }
    }
  }
  ctx.fill();
}
Draw the glyph on canvas
@param { CanvasRenderingContext2D } ctx 
@param { { x: number, y: number, on: boolean }[][] } glyph