emf-converter 4.8.11 → 4.8.13

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/browser.js CHANGED
@@ -15906,7 +15906,7 @@ function stopColorAt(stops, t) {
15906
15906
  }
15907
15907
  return stops[stops.length - 1].argb;
15908
15908
  }
15909
- function pathGradientColorAt(shape, x, y) {
15909
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15910
15910
  const { center, boundary, boundaryArgb } = shape;
15911
15911
  const n = boundary.length;
15912
15912
  const px = x - center.x;
@@ -15955,6 +15955,10 @@ function pathGradientColorAt(shape, x, y) {
15955
15955
  const ey = b.y - a.y;
15956
15956
  const cross = ax * ey - ay * ex;
15957
15957
  if (Math.abs(cross) < 1e-12) continue;
15958
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15959
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15960
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15961
+ }
15958
15962
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15959
15963
  const x2 = fx > 0 ? px / fx : 0;
15960
15964
  const y2 = fy > 0 ? py / fy : 0;
@@ -27507,7 +27511,7 @@ var RealizedFont = class {
27507
27511
  xs[i] = Math.round(m[0] * x - m[2] * y + subX);
27508
27512
  ys[i] = Math.round(-(m[1] * x - m[3] * y) - subY);
27509
27513
  } else {
27510
- xs[i] = Math.round(x + subX);
27514
+ xs[i] = this.gdiPlus && this.mode === "cleartype" ? x + subX : Math.round(x + subX);
27511
27515
  ys[i] = y - subY;
27512
27516
  }
27513
27517
  }
@@ -30409,7 +30413,8 @@ function pathGradientSampler(shape, wrap, device) {
30409
30413
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30410
30414
  }
30411
30415
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30412
- const c = pathGradientColorAt(shape, bx, by);
30416
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30417
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30413
30418
  if (c === null) {
30414
30419
  continue;
30415
30420
  }
@@ -33788,7 +33793,7 @@ function layoutGdiRun(font, run) {
33788
33793
  const origin = at(along, down);
33789
33794
  const fractionalX = !font.gridFit || font.fractionalOrigins;
33790
33795
  const ox = fractionalX ? Math.floor(origin.x) : Math.round(origin.x);
33791
- const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : Math.round((origin.x - ox) * 64);
33796
+ const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : font.fractionalOrigins === "x" ? Math.round((origin.x - ox) * 6) * (64 / 6) : Math.round((origin.x - ox) * 64);
33792
33797
  const oy = font.fractionalOrigins === "xy" ? Math.floor(origin.y) : Math.round(origin.y);
33793
33798
  const subY = font.fractionalOrigins === "xy" ? Math.round((origin.y - oy) * 4) * 16 : 0;
33794
33799
  origins.push({ x: ox + subX / 64, y: oy + subY / 64, along, down });
package/dist/browser.mjs CHANGED
@@ -15904,7 +15904,7 @@ function stopColorAt(stops, t) {
15904
15904
  }
15905
15905
  return stops[stops.length - 1].argb;
15906
15906
  }
15907
- function pathGradientColorAt(shape, x, y) {
15907
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15908
15908
  const { center, boundary, boundaryArgb } = shape;
15909
15909
  const n = boundary.length;
15910
15910
  const px = x - center.x;
@@ -15953,6 +15953,10 @@ function pathGradientColorAt(shape, x, y) {
15953
15953
  const ey = b.y - a.y;
15954
15954
  const cross = ax * ey - ay * ex;
15955
15955
  if (Math.abs(cross) < 1e-12) continue;
15956
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15957
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15958
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15959
+ }
15956
15960
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15957
15961
  const x2 = fx > 0 ? px / fx : 0;
15958
15962
  const y2 = fy > 0 ? py / fy : 0;
@@ -27505,7 +27509,7 @@ var RealizedFont = class {
27505
27509
  xs[i] = Math.round(m[0] * x - m[2] * y + subX);
27506
27510
  ys[i] = Math.round(-(m[1] * x - m[3] * y) - subY);
27507
27511
  } else {
27508
- xs[i] = Math.round(x + subX);
27512
+ xs[i] = this.gdiPlus && this.mode === "cleartype" ? x + subX : Math.round(x + subX);
27509
27513
  ys[i] = y - subY;
27510
27514
  }
27511
27515
  }
@@ -30407,7 +30411,8 @@ function pathGradientSampler(shape, wrap, device) {
30407
30411
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30408
30412
  }
30409
30413
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30410
- const c = pathGradientColorAt(shape, bx, by);
30414
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30415
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30411
30416
  if (c === null) {
30412
30417
  continue;
30413
30418
  }
@@ -33786,7 +33791,7 @@ function layoutGdiRun(font, run) {
33786
33791
  const origin = at(along, down);
33787
33792
  const fractionalX = !font.gridFit || font.fractionalOrigins;
33788
33793
  const ox = fractionalX ? Math.floor(origin.x) : Math.round(origin.x);
33789
- const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : Math.round((origin.x - ox) * 64);
33794
+ const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : font.fractionalOrigins === "x" ? Math.round((origin.x - ox) * 6) * (64 / 6) : Math.round((origin.x - ox) * 64);
33790
33795
  const oy = font.fractionalOrigins === "xy" ? Math.floor(origin.y) : Math.round(origin.y);
33791
33796
  const subY = font.fractionalOrigins === "xy" ? Math.round((origin.y - oy) * 4) * 16 : 0;
33792
33797
  origins.push({ x: ox + subX / 64, y: oy + subY / 64, along, down });
package/dist/index.js CHANGED
@@ -15907,7 +15907,7 @@ function stopColorAt(stops, t) {
15907
15907
  }
15908
15908
  return stops[stops.length - 1].argb;
15909
15909
  }
15910
- function pathGradientColorAt(shape, x, y) {
15910
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15911
15911
  const { center, boundary, boundaryArgb } = shape;
15912
15912
  const n = boundary.length;
15913
15913
  const px = x - center.x;
@@ -15956,6 +15956,10 @@ function pathGradientColorAt(shape, x, y) {
15956
15956
  const ey = b.y - a.y;
15957
15957
  const cross = ax * ey - ay * ex;
15958
15958
  if (Math.abs(cross) < 1e-12) continue;
15959
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15960
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15961
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15962
+ }
15959
15963
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15960
15964
  const x2 = fx > 0 ? px / fx : 0;
15961
15965
  const y2 = fy > 0 ? py / fy : 0;
@@ -27508,7 +27512,7 @@ var RealizedFont = class {
27508
27512
  xs[i] = Math.round(m[0] * x - m[2] * y + subX);
27509
27513
  ys[i] = Math.round(-(m[1] * x - m[3] * y) - subY);
27510
27514
  } else {
27511
- xs[i] = Math.round(x + subX);
27515
+ xs[i] = this.gdiPlus && this.mode === "cleartype" ? x + subX : Math.round(x + subX);
27512
27516
  ys[i] = y - subY;
27513
27517
  }
27514
27518
  }
@@ -30410,7 +30414,8 @@ function pathGradientSampler(shape, wrap, device) {
30410
30414
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30411
30415
  }
30412
30416
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30413
- const c = pathGradientColorAt(shape, bx, by);
30417
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30418
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30414
30419
  if (c === null) {
30415
30420
  continue;
30416
30421
  }
@@ -33789,7 +33794,7 @@ function layoutGdiRun(font, run) {
33789
33794
  const origin = at(along, down);
33790
33795
  const fractionalX = !font.gridFit || font.fractionalOrigins;
33791
33796
  const ox = fractionalX ? Math.floor(origin.x) : Math.round(origin.x);
33792
- const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : Math.round((origin.x - ox) * 64);
33797
+ const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : font.fractionalOrigins === "x" ? Math.round((origin.x - ox) * 6) * (64 / 6) : Math.round((origin.x - ox) * 64);
33793
33798
  const oy = font.fractionalOrigins === "xy" ? Math.floor(origin.y) : Math.round(origin.y);
33794
33799
  const subY = font.fractionalOrigins === "xy" ? Math.round((origin.y - oy) * 4) * 16 : 0;
33795
33800
  origins.push({ x: ox + subX / 64, y: oy + subY / 64, along, down });
package/dist/index.mjs CHANGED
@@ -15905,7 +15905,7 @@ function stopColorAt(stops, t) {
15905
15905
  }
15906
15906
  return stops[stops.length - 1].argb;
15907
15907
  }
15908
- function pathGradientColorAt(shape, x, y) {
15908
+ function pathGradientColorAt(shape, x, y, focusPoint) {
15909
15909
  const { center, boundary, boundaryArgb } = shape;
15910
15910
  const n = boundary.length;
15911
15911
  const px = x - center.x;
@@ -15954,6 +15954,10 @@ function pathGradientColorAt(shape, x, y) {
15954
15954
  const ey = b.y - a.y;
15955
15955
  const cross = ax * ey - ay * ex;
15956
15956
  if (Math.abs(cross) < 1e-12) continue;
15957
+ if (fx === 0 && fy > 0 && Math.abs((focusPoint?.x ?? x) - center.x) < eps && ex > 0 && Math.max(ax, ax + ex) > 0 && Math.abs(ey) > eps) {
15958
+ const u = (((focusPoint?.y ?? y) - center.y) / fy - ay) / ey;
15959
+ if (u >= -eps && u <= 1 + eps) inFocus = true;
15960
+ }
15957
15961
  if ((fx > 0 || Math.abs(px) < eps) && (fy > 0 || Math.abs(py) < eps)) {
15958
15962
  const x2 = fx > 0 ? px / fx : 0;
15959
15963
  const y2 = fy > 0 ? py / fy : 0;
@@ -27506,7 +27510,7 @@ var RealizedFont = class {
27506
27510
  xs[i] = Math.round(m[0] * x - m[2] * y + subX);
27507
27511
  ys[i] = Math.round(-(m[1] * x - m[3] * y) - subY);
27508
27512
  } else {
27509
- xs[i] = Math.round(x + subX);
27513
+ xs[i] = this.gdiPlus && this.mode === "cleartype" ? x + subX : Math.round(x + subX);
27510
27514
  ys[i] = y - subY;
27511
27515
  }
27512
27516
  }
@@ -30408,7 +30412,8 @@ function pathGradientSampler(shape, wrap, device) {
30408
30412
  by = foldIntoTile(by, box.y, box.h, mirrorY, lagY);
30409
30413
  }
30410
30414
  if (wrap === "clamp" && by >= box.y + box.h) continue;
30411
- const c = pathGradientColorAt(shape, bx, by);
30415
+ const focusPoint = bias && shape.focus?.x === 0 ? { x: bx - inv2[0] * bias, y: by - inv2[1] * bias } : void 0;
30416
+ const c = pathGradientColorAt(shape, bx, by, focusPoint);
30412
30417
  if (c === null) {
30413
30418
  continue;
30414
30419
  }
@@ -33787,7 +33792,7 @@ function layoutGdiRun(font, run) {
33787
33792
  const origin = at(along, down);
33788
33793
  const fractionalX = !font.gridFit || font.fractionalOrigins;
33789
33794
  const ox = fractionalX ? Math.floor(origin.x) : Math.round(origin.x);
33790
- const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : Math.round((origin.x - ox) * 64);
33795
+ const subX = !fractionalX ? 0 : font.fractionalOrigins === "xy" ? Math.round((origin.x - ox) * 4) * 16 : font.fractionalOrigins === "x" ? Math.round((origin.x - ox) * 6) * (64 / 6) : Math.round((origin.x - ox) * 64);
33791
33796
  const oy = font.fractionalOrigins === "xy" ? Math.floor(origin.y) : Math.round(origin.y);
33792
33797
  const subY = font.fractionalOrigins === "xy" ? Math.round((origin.y - oy) * 4) * 16 : 0;
33793
33798
  origins.push({ x: ox + subX / 64, y: oy + subY / 64, along, down });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emf-converter",
3
- "version": "4.8.11",
3
+ "version": "4.8.13",
4
4
  "description": "Convert EMF/WMF metafile binaries to PNG data URLs or SVG (markup, data URL, React/JSX)",
5
5
  "keywords": [
6
6
  "canvas",