@pixldocs/canvas-renderer 0.5.137 → 0.5.139

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.136";
15952
+ const PACKAGE_VERSION = "0.5.138";
15943
15953
  const roundParityValue = (value) => {
15944
15954
  if (typeof value !== "number") return value;
15945
15955
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -15960,6 +15970,12 @@ function logJsonLine(tag, payload) {
15960
15970
  console.log(tag, payload);
15961
15971
  }
15962
15972
  }
15973
+ function isFabricTextboxLike(obj) {
15974
+ return !!obj && (obj instanceof fabric.Textbox || obj.type === "textbox" || obj.type === "text" || typeof obj.getLineWidth === "function" && Array.isArray(obj._textLines));
15975
+ }
15976
+ function isFabricGroupLike(obj) {
15977
+ return !!obj && (obj instanceof fabric.Group || obj.type === "group" || Array.isArray(obj._objects) && typeof obj.getObjects === "function");
15978
+ }
15963
15979
  let __underlineFixInstalled = false;
15964
15980
  function installUnderlineFix(fab) {
15965
15981
  var _a;
@@ -16358,7 +16374,7 @@ class PixldocsRenderer {
16358
16374
  await this.waitForCanvasScene(container, cloned, i);
16359
16375
  }
16360
16376
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
16361
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CP-0GqFj.js");
16377
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Cj8x52ZL.js");
16362
16378
  const prepared = preparePagesForExport(
16363
16379
  cloned.pages,
16364
16380
  canvasWidth,
@@ -16934,7 +16950,7 @@ class PixldocsRenderer {
16934
16950
  const visit = (obj, groupPath = "") => {
16935
16951
  var _a2;
16936
16952
  if (!obj) return;
16937
- if (obj instanceof fabric.Textbox) {
16953
+ if (isFabricTextboxLike(obj)) {
16938
16954
  const lineWidths = getCanvasMeasuredTextboxLineWidths(obj);
16939
16955
  sample.push({
16940
16956
  id: getObjectId(obj),
@@ -16993,7 +17009,7 @@ class PixldocsRenderer {
16993
17009
  obj.dirty = true;
16994
17010
  return;
16995
17011
  }
16996
- if (obj instanceof fabric.Group) {
17012
+ if (isFabricGroupLike(obj)) {
16997
17013
  obj.getObjects().forEach(primeCharBounds);
16998
17014
  obj.dirty = true;
16999
17015
  }
@@ -18456,7 +18472,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
18456
18472
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
18457
18473
  sanitizeSvgTreeForPdf(svgToDraw);
18458
18474
  try {
18459
- const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-CP-0GqFj.js");
18475
+ const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-Cj8x52ZL.js");
18460
18476
  await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
18461
18477
  } catch (e) {
18462
18478
  console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
@@ -18801,4 +18817,4 @@ export {
18801
18817
  collectFontDescriptorsFromConfig as y,
18802
18818
  collectFontsFromConfig as z
18803
18819
  };
18804
- //# sourceMappingURL=index-Dr5P178V.js.map
18820
+ //# sourceMappingURL=index-O3SyxMKA.js.map