pa_font 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/paFont.cjs CHANGED
@@ -8,7 +8,7 @@ function toScreenPoint(point, scale) {
8
8
  return [point.x * scale, -point.y * scale];
9
9
  }
10
10
  function pushUniquePoint(points, point) {
11
- if (points.length === 0 || !pointsEqual2D$1(points[points.length - 1], point)) points.push(point);
11
+ if (points.length === 0 || !pointsEqual2D(points[points.length - 1], point)) points.push(point);
12
12
  }
13
13
  function flattenQuadratic(p0, p1, p2, tolerance, out) {
14
14
  let sp = 0;
@@ -237,7 +237,7 @@ function translateRect(rect, tx, ty) {
237
237
  h: rect.h
238
238
  };
239
239
  }
240
- function copyRing$1(ring) {
240
+ function copyRing(ring) {
241
241
  const len = ring.length;
242
242
  const result = new Array(len);
243
243
  for (let i = 0; i < len; i++) result[i] = [ring[i][0], ring[i][1]];
@@ -290,7 +290,7 @@ function normalizePositive(value, fallback) {
290
290
  function samePoint(a, b) {
291
291
  return a.x === b.x && a.y === b.y;
292
292
  }
293
- function pointsEqual2D$1(a, b) {
293
+ function pointsEqual2D(a, b) {
294
294
  return a[0] === b[0] && a[1] === b[1];
295
295
  }
296
296
  function pointsAlmostEqual2D(a, b, epsilon = 1e-6) {
@@ -966,8 +966,8 @@ function createDerivedShape(shape, parts) {
966
966
  }
967
967
  function createRegionCollection(shape) {
968
968
  return shape.parts.map((part) => ({
969
- outer: copyRing$1(part.outer),
970
- holes: part.holes.map((hole) => copyRing$1(hole)),
969
+ outer: copyRing(part.outer),
970
+ holes: part.holes.map((hole) => copyRing(hole)),
971
971
  bbox: { ...part.bbox }
972
972
  }));
973
973
  }
@@ -977,8 +977,8 @@ function copyParts(parts) {
977
977
  function copyPart(part) {
978
978
  return {
979
979
  ...part,
980
- outer: copyRing$1(part.outer),
981
- holes: part.holes.map((hole) => copyRing$1(hole)),
980
+ outer: copyRing(part.outer),
981
+ holes: part.holes.map((hole) => copyRing(hole)),
982
982
  anchors: part.anchors ? part.anchors.map((point) => [point[0], point[1]]) : void 0,
983
983
  bbox: { ...part.bbox }
984
984
  };
@@ -987,7 +987,7 @@ function copyContours(contours) {
987
987
  return contours.map((contour) => ({
988
988
  ...contour,
989
989
  bbox: { ...contour.bbox },
990
- ring: copyRing$1(contour.ring)
990
+ ring: copyRing(contour.ring)
991
991
  }));
992
992
  }
993
993
  function groupPartsByGlyphPosition(parts) {
@@ -1103,8 +1103,8 @@ function resolveGeometryEpsilon(width) {
1103
1103
  }
1104
1104
  function openPartWithSlit(part, width, epsilon) {
1105
1105
  if (!part.holes || part.holes.length === 0) return copyPart(part);
1106
- let outer = copyRing$1(part.outer);
1107
- const holes = part.holes.map((hole) => copyRing$1(hole));
1106
+ let outer = copyRing(part.outer);
1107
+ const holes = part.holes.map((hole) => copyRing(hole));
1108
1108
  const anchors = [];
1109
1109
  const blockers = [];
1110
1110
  while (holes.length > 0) {
@@ -1331,7 +1331,7 @@ function normalizeCutLocation(name, ring, cut, epsilon) {
1331
1331
  };
1332
1332
  }
1333
1333
  function ringPath(ring, startIndex, endIndex) {
1334
- if (startIndex == null || endIndex == null) return copyRing$1(ring);
1334
+ if (startIndex == null || endIndex == null) return copyRing(ring);
1335
1335
  const path = [ring[startIndex]];
1336
1336
  let cursor = startIndex;
1337
1337
  while (cursor !== endIndex) {
@@ -1346,7 +1346,7 @@ function appendPath(target, path, epsilon) {
1346
1346
  });
1347
1347
  }
1348
1348
  function resampleRing(ring, step, anchors = []) {
1349
- if (ring.length < 3) return copyRing$1(ring);
1349
+ if (ring.length < 3) return copyRing(ring);
1350
1350
  const normalizedAnchors = normalizeAnchorPoints(ring, anchors);
1351
1351
  if (normalizedAnchors.length >= 2) return resampleRingWithAnchors(ring, step, normalizedAnchors);
1352
1352
  return resampleClosedPath(ring, step);
@@ -1367,21 +1367,21 @@ function resampleRingWithAnchors(ring, step, anchorIndices) {
1367
1367
  appendPath(result, resampleOpenPath(ringPath(ring, startIndex, endIndex), step), 1e-6);
1368
1368
  }
1369
1369
  if (result.length > 1 && pointsAlmostEqual2D(result[0], result[result.length - 1], 1e-6)) result.pop();
1370
- if (result.length < 3 || result.length >= ring.length) return copyRing$1(ring);
1370
+ if (result.length < 3 || result.length >= ring.length) return copyRing(ring);
1371
1371
  return result;
1372
1372
  }
1373
1373
  function resampleClosedPath(ring, step) {
1374
1374
  const cumulative = buildCumulativeDistances(ring);
1375
1375
  const perimeter = cumulative[ring.length];
1376
- if (perimeter <= 1e-9) return copyRing$1(ring);
1376
+ if (perimeter <= 1e-9) return copyRing(ring);
1377
1377
  const pointCount = Math.max(3, Math.round(perimeter / step));
1378
- if (pointCount >= ring.length) return copyRing$1(ring);
1378
+ if (pointCount >= ring.length) return copyRing(ring);
1379
1379
  const sampled = [];
1380
1380
  for (let index = 0; index < pointCount; index++) {
1381
1381
  const point = pointAtClosedPathDistanceFast(ring, cumulative, perimeter * index / pointCount);
1382
1382
  if (sampled.length === 0 || !pointsAlmostEqual2D(sampled[sampled.length - 1], point, 1e-6)) sampled.push(point);
1383
1383
  }
1384
- if (sampled.length < 3 || sampled.length >= ring.length) return copyRing$1(ring);
1384
+ if (sampled.length < 3 || sampled.length >= ring.length) return copyRing(ring);
1385
1385
  return sampled;
1386
1386
  }
1387
1387
  function resampleOpenPath(path, step) {