@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.
@@ -14740,14 +14740,24 @@ async function registerRemoteFontFaceViaProxy(family, requestedWeight, styleRaw)
14740
14740
  const dataUri = await fetchFontProxyDataUri(family, actualWeight, style, source);
14741
14741
  if (!dataUri) continue;
14742
14742
  try {
14743
- const face = new FontFace(family, `url("${dataUri}")`, {
14744
- weight: String(actualWeight),
14745
- style
14746
- });
14747
- await face.load();
14748
- document.fonts.add(face);
14749
- appendDataUriFontFaceRule(family, actualWeight, style, dataUri);
14750
- registeredRemoteFontFaces.add(faceKey);
14743
+ const weightsToRegister = /* @__PURE__ */ new Set([actualWeight]);
14744
+ const requestedNum = Number.isFinite(parsed) ? Math.max(100, Math.min(900, parsed)) : 400;
14745
+ weightsToRegister.add(requestedNum);
14746
+ for (const w of weightsToRegister) {
14747
+ const aliasKey = `${family}|${w}|${style}|${source}`;
14748
+ if (registeredRemoteFontFaces.has(aliasKey)) continue;
14749
+ try {
14750
+ const face = new FontFace(family, `url("${dataUri}")`, {
14751
+ weight: String(w),
14752
+ style
14753
+ });
14754
+ await face.load();
14755
+ document.fonts.add(face);
14756
+ appendDataUriFontFaceRule(family, w, style, dataUri);
14757
+ registeredRemoteFontFaces.add(aliasKey);
14758
+ } catch {
14759
+ }
14760
+ }
14751
14761
  return true;
14752
14762
  } catch {
14753
14763
  }
@@ -15939,7 +15949,7 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
15939
15949
  }
15940
15950
  return svgString;
15941
15951
  }
15942
- const PACKAGE_VERSION = "0.5.138";
15952
+ const PACKAGE_VERSION = "0.5.140";
15943
15953
  const roundParityValue = (value) => {
15944
15954
  if (typeof value !== "number") return value;
15945
15955
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -16364,7 +16374,7 @@ class PixldocsRenderer {
16364
16374
  await this.waitForCanvasScene(container, cloned, i);
16365
16375
  }
16366
16376
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16367
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BGqNP_R0.js");
16377
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CAZ5WjdB.js");
16368
16378
  const prepared = preparePagesForExport(
16369
16379
  cloned.pages,
16370
16380
  canvasWidth,
@@ -16961,7 +16971,7 @@ class PixldocsRenderer {
16961
16971
  maxLineWidth: lineWidths.length ? Math.max(...lineWidths) : 0
16962
16972
  });
16963
16973
  }
16964
- if (obj instanceof fabric.Group && typeof obj.getObjects === "function") {
16974
+ if (isFabricGroupLike(obj)) {
16965
16975
  const nextPath = [groupPath, getObjectId(obj) || obj.type || "group"].filter(Boolean).join("/");
16966
16976
  obj.getObjects().forEach((child) => visit(child, nextPath));
16967
16977
  }
@@ -16980,7 +16990,7 @@ class PixldocsRenderer {
16980
16990
  this.logFabricTextParitySnapshot("before-stable-text-metrics", fabricInstance);
16981
16991
  const waitForPaint = () => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(() => r())));
16982
16992
  const primeCharBounds = (obj) => {
16983
- if (obj instanceof fabric.Textbox) {
16993
+ if (isFabricTextboxLike(obj)) {
16984
16994
  try {
16985
16995
  obj.__lineWidths = [];
16986
16996
  obj.__lineHeights = [];
@@ -18462,7 +18472,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18462
18472
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18463
18473
  sanitizeSvgTreeForPdf(svgToDraw);
18464
18474
  try {
18465
- const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-BGqNP_R0.js");
18475
+ const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-CAZ5WjdB.js");
18466
18476
  await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
18467
18477
  } catch (e) {
18468
18478
  console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
@@ -18807,4 +18817,4 @@ export {
18807
18817
  collectFontDescriptorsFromConfig as y,
18808
18818
  collectFontsFromConfig as z
18809
18819
  };
18810
- //# sourceMappingURL=index-D-I6bYGU.js.map
18820
+ //# sourceMappingURL=index-Dk-69Lq1.js.map