@pixldocs/canvas-renderer 0.5.138 → 0.5.140

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.
@@ -14758,14 +14758,24 @@ async function registerRemoteFontFaceViaProxy(family, requestedWeight, styleRaw)
14758
14758
  const dataUri = await fetchFontProxyDataUri(family, actualWeight, style, source);
14759
14759
  if (!dataUri) continue;
14760
14760
  try {
14761
- const face = new FontFace(family, `url("${dataUri}")`, {
14762
- weight: String(actualWeight),
14763
- style
14764
- });
14765
- await face.load();
14766
- document.fonts.add(face);
14767
- appendDataUriFontFaceRule(family, actualWeight, style, dataUri);
14768
- registeredRemoteFontFaces.add(faceKey);
14761
+ const weightsToRegister = /* @__PURE__ */ new Set([actualWeight]);
14762
+ const requestedNum = Number.isFinite(parsed) ? Math.max(100, Math.min(900, parsed)) : 400;
14763
+ weightsToRegister.add(requestedNum);
14764
+ for (const w of weightsToRegister) {
14765
+ const aliasKey = `${family}|${w}|${style}|${source}`;
14766
+ if (registeredRemoteFontFaces.has(aliasKey)) continue;
14767
+ try {
14768
+ const face = new FontFace(family, `url("${dataUri}")`, {
14769
+ weight: String(w),
14770
+ style
14771
+ });
14772
+ await face.load();
14773
+ document.fonts.add(face);
14774
+ appendDataUriFontFaceRule(family, w, style, dataUri);
14775
+ registeredRemoteFontFaces.add(aliasKey);
14776
+ } catch {
14777
+ }
14778
+ }
14769
14779
  return true;
14770
14780
  } catch {
14771
14781
  }
@@ -15957,7 +15967,7 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
15957
15967
  }
15958
15968
  return svgString;
15959
15969
  }
15960
- const PACKAGE_VERSION = "0.5.138";
15970
+ const PACKAGE_VERSION = "0.5.140";
15961
15971
  const roundParityValue = (value) => {
15962
15972
  if (typeof value !== "number") return value;
15963
15973
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -16382,7 +16392,7 @@ class PixldocsRenderer {
16382
16392
  await this.waitForCanvasScene(container, cloned, i);
16383
16393
  }
16384
16394
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16385
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Bw9l0p9C.cjs"));
16395
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-uR2FxMCo.cjs"));
16386
16396
  const prepared = preparePagesForExport(
16387
16397
  cloned.pages,
16388
16398
  canvasWidth,
@@ -16979,7 +16989,7 @@ class PixldocsRenderer {
16979
16989
  maxLineWidth: lineWidths.length ? Math.max(...lineWidths) : 0
16980
16990
  });
16981
16991
  }
16982
- if (obj instanceof fabric__namespace.Group && typeof obj.getObjects === "function") {
16992
+ if (isFabricGroupLike(obj)) {
16983
16993
  const nextPath = [groupPath, getObjectId(obj) || obj.type || "group"].filter(Boolean).join("/");
16984
16994
  obj.getObjects().forEach((child) => visit(child, nextPath));
16985
16995
  }
@@ -16998,7 +17008,7 @@ class PixldocsRenderer {
16998
17008
  this.logFabricTextParitySnapshot("before-stable-text-metrics", fabricInstance);
16999
17009
  const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
17000
17010
  const primeCharBounds = (obj) => {
17001
- if (obj instanceof fabric__namespace.Textbox) {
17011
+ if (isFabricTextboxLike(obj)) {
17002
17012
  try {
17003
17013
  obj.__lineWidths = [];
17004
17014
  obj.__lineHeights = [];
@@ -18480,7 +18490,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18480
18490
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18481
18491
  sanitizeSvgTreeForPdf(svgToDraw);
18482
18492
  try {
18483
- const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-Bw9l0p9C.cjs"));
18493
+ const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-uR2FxMCo.cjs"));
18484
18494
  await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
18485
18495
  } catch (e) {
18486
18496
  console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
@@ -18822,4 +18832,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
18822
18832
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
18823
18833
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
18824
18834
  exports.warmTemplateFromForm = warmTemplateFromForm;
18825
- //# sourceMappingURL=index-CkbBhnZd.cjs.map
18835
+ //# sourceMappingURL=index-DhQsu_MH.cjs.map