@pixldocs/canvas-renderer 0.5.107 → 0.5.109

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/index.cjs CHANGED
@@ -17326,24 +17326,19 @@ async function convertTextDecorationsToLines(svg) {
17326
17326
  if (liveTspan) {
17327
17327
  try {
17328
17328
  const liveCharCount = liveTspan.getNumberOfChars();
17329
- const svgWidth = liveTspan.getComputedTextLength();
17330
- if (Number.isFinite(svgWidth) && svgWidth > 0) {
17331
- textWidth = Math.max(textWidth, svgWidth);
17332
- }
17333
17329
  if (liveCharCount > 0) {
17334
17330
  const start = liveTspan.getStartPositionOfChar(0);
17335
17331
  const end = liveTspan.getEndPositionOfChar(liveCharCount - 1);
17336
17332
  if (Number.isFinite(start.x)) lineStartX = start.x;
17337
17333
  if (Number.isFinite(start.y)) baselineY = start.y;
17338
- if (Number.isFinite(end.x)) lineEndX = Math.max(end.x, lineStartX + textWidth);
17334
+ if (Number.isFinite(end.x)) lineEndX = end.x;
17339
17335
  if (Number.isFinite(end.y) && !Number.isFinite(baselineY)) baselineY = end.y;
17340
17336
  } else {
17341
- lineEndX = lineStartX + textWidth;
17342
- }
17343
- const bbox = liveTspan.getBBox();
17344
- if (Number.isFinite(bbox.x) && Number.isFinite(bbox.width)) {
17345
- lineStartX = Math.min(lineStartX, bbox.x);
17346
- lineEndX = Math.max(lineEndX, bbox.x + bbox.width);
17337
+ const svgWidth = liveTspan.getComputedTextLength();
17338
+ if (Number.isFinite(svgWidth) && svgWidth > 0) {
17339
+ textWidth = svgWidth;
17340
+ lineEndX = lineStartX + textWidth;
17341
+ }
17347
17342
  }
17348
17343
  } catch {
17349
17344
  }
@@ -17677,7 +17672,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
17677
17672
  const hasGradient = !!((_b = (_a = page.backgroundGradient) == null ? void 0 : _a.stops) == null ? void 0 : _b.length);
17678
17673
  drawPageBackground(pdf, i, page.width, page.height, page.backgroundColor, page.backgroundGradient);
17679
17674
  const shouldStripBg = stripPageBackground ?? hasGradient;
17680
- const textMode = options.textMode ?? (options.outlineText === false ? "selectable" : "selectable");
17675
+ const textMode = options.textMode ?? (options.outlineText === false ? "selectable" : "pixel-perfect");
17681
17676
  const shouldOutlineText = textMode === "pixel-perfect" || textMode === "auto";
17682
17677
  const outlineSubMode = textMode === "auto" ? "complex-only" : "all";
17683
17678
  let pageSvg = page.svg;
@@ -17691,7 +17686,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
17691
17686
  }
17692
17687
  if (shouldOutlineText) {
17693
17688
  try {
17694
- const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-DTKsddnS.cjs"));
17689
+ const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-CeL46_ks.cjs"));
17695
17690
  pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl, { mode: outlineSubMode });
17696
17691
  try {
17697
17692
  dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");