function stringifyContours(contours) {
  let shapeDesc = '';
  contours.forEach(contour => {
    shapeDesc += '{';
    const lastIndex = contour.length - 1;
    let _x, _y;
    contour.forEach((command, index) => {
      roundAllValue(command, 3);
      if (command.type === 'Z') {
        if (contour[0].x !== _x || contour[0].y !== _y) {
          shapeDesc += '# ';
        }
      } else {
        if (command.type === 'C') {
          shapeDesc += `(${command.x1}, ${command.y1}; ${command.x2}, ${command.y2}); `;
        } else if (command.type === 'Q') {
          shapeDesc += `(${command.x1}, ${command.y1}); `;
        }
        shapeDesc += `${command.x}, ${command.y}`;
        _x = command.x;
        _y = command.y;
        if (index !== lastIndex) {
          shapeDesc += '; ';
        }
      }
    });
    shapeDesc += '}';
  });
  return shapeDesc;
}
/**
 * Convert contour commands to msdfgen shape description 
 * 
 * @param {Array} contours Array of font contour
 * @returns {string} 
 */
Convert contour commands to msdfgen shape description

@param {Array} contours Array of font contour
@returns {string}
Convert contour commands to msdfgen shape description @param { Array } contours Array of font contour @returns { string }
function stringifyContours(contours) {
  let shapeDesc = '';
  contours.forEach(contour => {
    shapeDesc += '{';
    const lastIndex = contour.length - 1;
    let _x, _y;
    contour.forEach((command, index) => {
      roundAllValue(command, 3);
      if (command.type === 'Z') {
        if (contour[0].x !== _x || contour[0].y !== _y) {
          shapeDesc += '# ';
        }
      } else {
        if (command.type === 'C') {
          shapeDesc += `(${command.x1}, ${command.y1}; ${command.x2}, ${command.y2}); `;
        } else if (command.type === 'Q') {
          shapeDesc += `(${command.x1}, ${command.y1}); `;
        }
        shapeDesc += `${command.x}, ${command.y}`;
        _x = command.x;
        _y = command.y;
        if (index !== lastIndex) {
          shapeDesc += '; ';
        }
      }
    });
    shapeDesc += '}';
  });
  return shapeDesc;
}
function stringifyContours ( contours ) { let shapeDesc = '' ; contours . forEach ( contour => { shapeDesc += '{' ; const lastIndex = contour . length - 1 ; let _x , _y ; contour . forEach ( ( command , index ) => { roundAllValue ( command , 3 ) ; if ( command . type === 'Z' ) { if ( contour [ 0 ] . x !== _x || contour [ 0 ] . y !== _y ) { shapeDesc += '# ' ; } } else { if ( command . type === 'C' ) { shapeDesc += ` ${ command . x1 } ${ command . y1 } ${ command . x2 } ${ command . y2 } ` ; } else if ( command . type === 'Q' ) { shapeDesc += ` ${ command . x1 } ${ command . y1 } ` ; } shapeDesc += ` ${ command . x } ${ command . y } ` ; _x = command . x ; _y = command . y ; if ( index !== lastIndex ) { shapeDesc += '; ' ; } } } ) ; shapeDesc += '}' ; } ) ; return shapeDesc ; }
Convert contour commands to msdfgen shape description
Convert contour commands to msdfgen shape description