function toGlyph(onPts, offPts, offOnIndices, onContourIndices) {
  const contours = [];

  let currentContour = [];
  let offIndex = 0;
  onPts.forEach((pt, onIndex) => {
    if (onContourIndices[onIndex] !== contours.length) {
      contours.push(currentContour);
      currentContour = [];
    }
    currentContour.push({ x: pt[0], y: pt[1], on: true });
    if (offIndex <= offPts.length - 1 && offOnIndices[offIndex] === onIndex) {
      const offPt1 = offPts[offIndex], offPt2 = offPts[offIndex+1];
      currentContour.push({ x: offPt1[0], y: offPt1[1], on: false });
      currentContour.push({ x: offPt2[0], y: offPt2[1], on: false });
      offIndex += 2;
    }
  });
  contours.push(currentContour);
  return contours;
}
Convert the on/off points to glyph contour representation
@param { [number, number][] } onPts 
@param { [number, number][] } offPts 
@param { number[] } offOnIndices 
@param { number[] } onContourIndices