From 70f8fee94d80b12020c256dd8d962f1b73cf4fcd Mon Sep 17 00:00:00 2001 From: Just van Rossum Date: Sat, 16 Sep 2023 15:36:10 +0200 Subject: [PATCH] Ensure 'other' argument is also VarPackedPath instance; drop (unused) support for raw coord array in path.addItemWise and path.subItemWise --- src/fontra/client/core/var-path.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/src/fontra/client/core/var-path.js b/src/fontra/client/core/var-path.js index f4df73b36..30f694316 100644 --- a/src/fontra/client/core/var-path.js +++ b/src/fontra/client/core/var-path.js @@ -554,30 +554,18 @@ export class VarPackedPath { } addItemwise(other) { - let otherCoordinates; - if (other instanceof VarPackedPath) { - this._ensureCompatibility(other); - otherCoordinates = other.coordinates; - } else { - otherCoordinates = other; - } + this._ensureCompatibility(other); return new this.constructor( - this.coordinates.addItemwise(otherCoordinates), + this.coordinates.addItemwise(other.coordinates), this.pointTypes, this.contourInfo ); } subItemwise(other) { - let otherCoordinates; - if (other instanceof VarPackedPath) { - this._ensureCompatibility(other); - otherCoordinates = other.coordinates; - } else { - otherCoordinates = other; - } + this._ensureCompatibility(other); return new this.constructor( - this.coordinates.subItemwise(otherCoordinates), + this.coordinates.subItemwise(other.coordinates), this.pointTypes, this.contourInfo ); @@ -585,6 +573,7 @@ export class VarPackedPath { _ensureCompatibility(other) { if ( + !(other instanceof VarPackedPath) || !arrayEquals(this.contourInfo, other.contourInfo) || !pointTypesEquals(this.pointTypes, other.pointTypes) ) {