@pixldocs/canvas-renderer 0.5.106 → 0.5.108

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
@@ -15927,8 +15927,15 @@ function isBasicLatinOrLatin1(char) {
15927
15927
  const c = char.codePointAt(0) ?? 0;
15928
15928
  return c <= 591;
15929
15929
  }
15930
+ function isCommonLatinPunctuation(char) {
15931
+ const c = char.codePointAt(0) ?? 0;
15932
+ if (c >= 8208 && c <= 8265) return true;
15933
+ if (c === 8467 || c === 8482) return true;
15934
+ return false;
15935
+ }
15930
15936
  function classifyChar(char) {
15931
15937
  if (isBasicLatinOrLatin1(char)) return "main";
15938
+ if (isCommonLatinPunctuation(char)) return "main";
15932
15939
  if (isDevanagari(char)) return "devanagari";
15933
15940
  return "symbol";
15934
15941
  }
@@ -17300,24 +17307,19 @@ async function convertTextDecorationsToLines(svg) {
17300
17307
  if (liveTspan) {
17301
17308
  try {
17302
17309
  const liveCharCount = liveTspan.getNumberOfChars();
17303
- const svgWidth = liveTspan.getComputedTextLength();
17304
- if (Number.isFinite(svgWidth) && svgWidth > 0) {
17305
- textWidth = Math.max(textWidth, svgWidth);
17306
- }
17307
17310
  if (liveCharCount > 0) {
17308
17311
  const start = liveTspan.getStartPositionOfChar(0);
17309
17312
  const end = liveTspan.getEndPositionOfChar(liveCharCount - 1);
17310
17313
  if (Number.isFinite(start.x)) lineStartX = start.x;
17311
17314
  if (Number.isFinite(start.y)) baselineY = start.y;
17312
- if (Number.isFinite(end.x)) lineEndX = Math.max(end.x, lineStartX + textWidth);
17315
+ if (Number.isFinite(end.x)) lineEndX = end.x;
17313
17316
  if (Number.isFinite(end.y) && !Number.isFinite(baselineY)) baselineY = end.y;
17314
17317
  } else {
17315
- lineEndX = lineStartX + textWidth;
17316
- }
17317
- const bbox = liveTspan.getBBox();
17318
- if (Number.isFinite(bbox.x) && Number.isFinite(bbox.width)) {
17319
- lineStartX = Math.min(lineStartX, bbox.x);
17320
- 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
+ }
17321
17323
  }
17322
17324
  } catch {
17323
17325
  }