@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.cjs CHANGED
@@ -15946,8 +15946,15 @@ function isBasicLatinOrLatin1(char) {
15946
15946
  const c = char.codePointAt(0) ?? 0;
15947
15947
  return c <= 591;
15948
15948
  }
15949
+ function isCommonLatinPunctuation(char) {
15950
+ const c = char.codePointAt(0) ?? 0;
15951
+ if (c >= 8208 && c <= 8265) return true;
15952
+ if (c === 8467 || c === 8482) return true;
15953
+ return false;
15954
+ }
15949
15955
  function classifyChar(char) {
15950
15956
  if (isBasicLatinOrLatin1(char)) return "main";
15957
+ if (isCommonLatinPunctuation(char)) return "main";
15951
15958
  if (isDevanagari(char)) return "devanagari";
15952
15959
  return "symbol";
15953
15960
  }
@@ -17319,24 +17326,19 @@ async function convertTextDecorationsToLines(svg) {
17319
17326
  if (liveTspan) {
17320
17327
  try {
17321
17328
  const liveCharCount = liveTspan.getNumberOfChars();
17322
- const svgWidth = liveTspan.getComputedTextLength();
17323
- if (Number.isFinite(svgWidth) && svgWidth > 0) {
17324
- textWidth = Math.max(textWidth, svgWidth);
17325
- }
17326
17329
  if (liveCharCount > 0) {
17327
17330
  const start = liveTspan.getStartPositionOfChar(0);
17328
17331
  const end = liveTspan.getEndPositionOfChar(liveCharCount - 1);
17329
17332
  if (Number.isFinite(start.x)) lineStartX = start.x;
17330
17333
  if (Number.isFinite(start.y)) baselineY = start.y;
17331
- if (Number.isFinite(end.x)) lineEndX = Math.max(end.x, lineStartX + textWidth);
17334
+ if (Number.isFinite(end.x)) lineEndX = end.x;
17332
17335
  if (Number.isFinite(end.y) && !Number.isFinite(baselineY)) baselineY = end.y;
17333
17336
  } else {
17334
- lineEndX = lineStartX + textWidth;
17335
- }
17336
- const bbox = liveTspan.getBBox();
17337
- if (Number.isFinite(bbox.x) && Number.isFinite(bbox.width)) {
17338
- lineStartX = Math.min(lineStartX, bbox.x);
17339
- 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
+ }
17340
17342
  }
17341
17343
  } catch {
17342
17344
  }