@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.js CHANGED
@@ -17307,24 +17307,19 @@ async function convertTextDecorationsToLines(svg) {
17307
17307
  if (liveTspan) {
17308
17308
  try {
17309
17309
  const liveCharCount = liveTspan.getNumberOfChars();
17310
- const svgWidth = liveTspan.getComputedTextLength();
17311
- if (Number.isFinite(svgWidth) && svgWidth > 0) {
17312
- textWidth = Math.max(textWidth, svgWidth);
17313
- }
17314
17310
  if (liveCharCount > 0) {
17315
17311
  const start = liveTspan.getStartPositionOfChar(0);
17316
17312
  const end = liveTspan.getEndPositionOfChar(liveCharCount - 1);
17317
17313
  if (Number.isFinite(start.x)) lineStartX = start.x;
17318
17314
  if (Number.isFinite(start.y)) baselineY = start.y;
17319
- if (Number.isFinite(end.x)) lineEndX = Math.max(end.x, lineStartX + textWidth);
17315
+ if (Number.isFinite(end.x)) lineEndX = end.x;
17320
17316
  if (Number.isFinite(end.y) && !Number.isFinite(baselineY)) baselineY = end.y;
17321
17317
  } else {
17322
- lineEndX = lineStartX + textWidth;
17323
- }
17324
- const bbox = liveTspan.getBBox();
17325
- if (Number.isFinite(bbox.x) && Number.isFinite(bbox.width)) {
17326
- lineStartX = Math.min(lineStartX, bbox.x);
17327
- lineEndX = Math.max(lineEndX, bbox.x + bbox.width);
17318
+ const svgWidth = liveTspan.getComputedTextLength();
17319
+ if (Number.isFinite(svgWidth) && svgWidth > 0) {
17320
+ textWidth = svgWidth;
17321
+ lineEndX = lineStartX + textWidth;
17322
+ }
17328
17323
  }
17329
17324
  } catch {
17330
17325
  }
@@ -17658,7 +17653,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
17658
17653
  const hasGradient = !!((_b = (_a = page.backgroundGradient) == null ? void 0 : _a.stops) == null ? void 0 : _b.length);
17659
17654
  drawPageBackground(pdf, i, page.width, page.height, page.backgroundColor, page.backgroundGradient);
17660
17655
  const shouldStripBg = stripPageBackground ?? hasGradient;
17661
- const textMode = options.textMode ?? (options.outlineText === false ? "selectable" : "selectable");
17656
+ const textMode = options.textMode ?? (options.outlineText === false ? "selectable" : "pixel-perfect");
17662
17657
  const shouldOutlineText = textMode === "pixel-perfect" || textMode === "auto";
17663
17658
  const outlineSubMode = textMode === "auto" ? "complex-only" : "all";
17664
17659
  let pageSvg = page.svg;
@@ -17672,7 +17667,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
17672
17667
  }
17673
17668
  if (shouldOutlineText) {
17674
17669
  try {
17675
- const { convertAllTextToPath } = await import("./svgTextToPath-C20Obtt2.js");
17670
+ const { convertAllTextToPath } = await import("./svgTextToPath-B2UVS22F.js");
17676
17671
  pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl, { mode: outlineSubMode });
17677
17672
  try {
17678
17673
  dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");