extend method

dynamic extend(
  1. dynamic pathOrCommands
)

Add the given path or list of commands to the commands of this path. @param {Array} pathOrCommands - another opentype.Path, an opentype.BoundingBox, or an array of commands.

Implementation

extend(pathOrCommands) {
  if (pathOrCommands.commands) {
      pathOrCommands = pathOrCommands.commands;
  } else if (pathOrCommands is BoundingBox) {
      var box = pathOrCommands;
      this.moveTo(box.x1!, box.y1!);
      this.lineTo(box.x2, box.y1);
      this.lineTo(box.x2, box.y2);
      this.lineTo(box.x1, box.y2);
      this.close();
      return;
  }

  this.commands.add(pathOrCommands);
}