svgdotjs / svgdom

Straightforward DOM implementation to make SVG.js run headless on Node.js
MIT License
269 stars 53 forks source link

Throws error when the SVG has path element with empty d attribute. #116

Closed banujan6 closed 10 months ago

banujan6 commented 10 months ago

I am working on manipulating SVG on the Service Side with node + svgdom + svgjs. The SVG is generated from PDF using pdf2svg. The generated SVGs often have path tags with empty d attributes.

<path style="stroke:none;" d=""/>

So, parsing such SVG throws the following error:

webpack://svgdom/./src/utils/pathUtils.js:131
      pathHandlers[s].call(null,
^
TypeError: Cannot read properties of undefined (reading 'call')
    at pathParser (webpack://svgdom/./src/utils/pathUtils.js:131:1)
    at Module.getPathSegments (webpack://svgdom/./src/utils/pathUtils.js:639:1)
    at getPathSegments (webpack://svgdom/./src/utils/bboxUtils.js:62:12)
    at getSegments (webpack://svgdom/./src/utils/bboxUtils.js:16:1)
    at webpack://svgdom/./src/utils/bboxUtils.js:48:1
    at Array.reduce (<anonymous>)
    at getPathSegments (webpack://svgdom/./src/utils/bboxUtils.js:46:1)
    at getSegments (webpack://svgdom/./src/utils/bboxUtils.js:16:1)
    at webpack://svgdom/./src/utils/bboxUtils.js:48:1
    at Array.reduce (<anonymous>)

Code Sample

import { SVG } from '@svgdotjs/svg.js';
const { createSVGWindow } = require('svgdom');

global.window = createSVGWindow();
global.document = global.window.document;

// register window and document
registerWindow(window, document);

const canvas = SVG( svgString );

Works Fine

<symbol overflow="visible" id="glyph1-1">
      <path style="stroke:none;" d="M 8.84375 -0.203125 L 7.8125 0.828125 L 6.53125 -0.453125 C 5.914062 -0.078125 5.207031 0.109375 4.40625 0.109375 C 3.269531 0.109375 2.328125 -0.242188 1.578125 -0.953125 C 0.828125 -1.671875 0.453125 -2.5625 0.453125 -3.625 C 0.453125 -4.695312 0.828125 -5.585938 1.578125 -6.296875 C 2.328125 -7.003906 3.269531 -7.359375 4.40625 -7.359375 C 5.519531 -7.359375 6.453125 -7.003906 7.203125 -6.296875 C 7.960938 -5.585938 8.34375 -4.695312 8.34375 -3.625 C 8.34375 -2.8125 8.101562 -2.082031 7.625 -1.4375 Z M 2.859375 -2.046875 C 3.265625 -1.640625 3.773438 -1.4375 4.390625 -1.4375 C 5.015625 -1.4375 5.523438 -1.640625 5.921875 -2.046875 C 6.328125 -2.460938 6.53125 -2.988281 6.53125 -3.625 C 6.53125 -4.269531 6.328125 -4.796875 5.921875 -5.203125 C 5.523438 -5.617188 5.015625 -5.828125 4.390625 -5.828125 C 3.773438 -5.828125 3.265625 -5.617188 2.859375 -5.203125 C 2.453125 -4.796875 2.25 -4.269531 2.25 -3.625 C 2.25 -2.988281 2.453125 -2.460938 2.859375 -2.046875 Z M 2.859375 -2.046875 "/>
</symbol>

Not Working

<symbol overflow="visible" id="glyph1-0">
     <path style="stroke:none;" d=""/>
</symbol>

Environment

NodeJS v19.7.0, @svgdotjs/svg.js ^3.1.2, MacOS Ventura - M1

banujan6 commented 10 months ago

~Temp Fix~

~I have added a temporary fix in the utils/pathUtils.js file. I simply wrapped it with an if condition.~

if (pathHandlers[s]) {
   arr.push(
       pathHandlers[s].call(null,
          array.slice(index, (index = index + paramCnt[s.toUpperCase()])).map(parseFloat),
          p, r, p0,
          isBeziere(arr[arr.length - 1])
       )
   )
}

~The above change resolves the issue and gives the expected output. But I am not sure If it causes any other side effects in any other scenario. Update here if it is a valid fix so I can send the PR.~

Fuzzyma commented 10 months ago

I cannot reproduce this issue on my machine. Can you try updating your svg.js version?

banujan6 commented 10 months ago

I am using the latest version of svg.js -> "version": "3.2.0",. I have attached the SVG I used.

SVG File

banujan6 commented 10 months ago

In my case, I get undefined for the array parameter for those paths.

const pathParser = (array) => {...}

I added a condition as below:

const pathParser = (array) => {

  // If the array is undefined just return an empty array.
  if ( !array ) {
    return [];
  }

  // prepare for parsing
  const paramCnt = { M: 2, L: 2, H: 1, V: 1, C: 6, S: 4, Q: 4, T: 2, A: 7, Z: 0 }

Now it solves the problem for now.

Fuzzyma commented 10 months ago

Your code sample looks a bit off. How does this work?

import { SVG } from '@svgdotjs/svg.js';
const { createSVGWindow } = require('svgdom');

// register window and document
registerWindow(window, document); // <-- you register window and document before you even created it

global.window = createSVGWindow(); // <-- this should go above
global.document = global.window.document;

const canvas = SVG( svgString );

This shouldntw work at all... (unless you are running this code in a browser where window and document are defined)

I trid your example and it just runs like normal. No errors are thrown. A

banujan6 commented 10 months ago

@Fuzzyma My bad. I cleaned up some other code to provide a clean example, I messed up with the order. However, In my original code, it is in the correct order. Also works fine for SVGs except for this specific scenario.

Let me de-couple this part from the project and try with a new node project.

Fuzzyma commented 10 months ago

Really weird. The thing is I totally expect this to be a bug but it just doesnt happen in my code so I assume I just have bug in my example to reproduce your bug lol.

banujan6 commented 10 months ago

I understand. I do a lot of manipulation on SVG, Let me narrow it down. May be I am doing something wrong.

banujan6 commented 10 months ago

@Fuzzyma It happens here bbox = itemCanvas.node.getBBox();.

The itemCanvas is an SVG object and topGroupElement is a high-level group element.

for (let item of topGroupElement.children ) {
     const itemCanvas = SVG();
     const group = itemCanvas.group();

     // Doing a lot of transformation for each type of element path / use / g / etc..
     //After all, append the item to the newly created canvas.
     group.add( item as any );

    // recalculate the bbox, This is where the error occurs if the path exist without d values
     const bbox = itemCanvas.node.getBBox();
}

Stack:

TypeError: Cannot read properties of undefined (reading 'call')
    at pathParser (webpack://svgdom/./src/utils/pathUtils.js:135:1)
    at Module.getPathSegments (webpack://svgdom/./src/utils/pathUtils.js:643:1)
    at getPathSegments (webpack://svgdom/./src/utils/bboxUtils.js:62:12)
    at getSegments (webpack://svgdom/./src/utils/bboxUtils.js:16:1)
    at webpack://svgdom/./src/utils/bboxUtils.js:48:1
    at Array.reduce (<anonymous>)
    at getPathSegments (webpack://svgdom/./src/utils/bboxUtils.js:46:1)
    at getSegments (webpack://svgdom/./src/utils/bboxUtils.js:16:1)
    at webpack://svgdom/./src/utils/bboxUtils.js:48:1
    at Array.reduce (<anonymous>)
Fuzzyma commented 10 months ago

Wait, so running

const canvas = SVG('<path d="" />')

is not enough to trigger it? Because thats what your reproduction says!

banujan6 commented 10 months ago

Yeah I am sorry. It happens when calculating the bbox. The reason we create SVG element for each item, Coz we want to isolate each item in svg to our internal format. So,

<defs>
   <symbol xmlns="http://www.w3.org/2000/svg" overflow="visible" id="glyph0-0">
      <path style="stroke:none;" d=""/>
   </symbol>
</defs>
<g>
    <use xlink:href="#glyph0-0">
<g>

Need to be converted to,

<svg>
   <g>
       <path style="stroke:none;" d=""/>
   </g>
</svg>

After the conversion, when calculating the bbox only I get the above error.

EDIT:

The value of itemCanvas.svg() for the error occuring item is:

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs"><g><g style="fill:rgb(10.198975%,10.198975%,10.198975%);fill-opacity:1;"><g><path style="stroke:none;" d="M 2.03125 -3.109375 C 1.738281 -3.109375 1.507812 -2.992188 1.34375 -2.765625 C 1.1875 -2.546875 1.109375 -2.238281 1.109375 -1.84375 C 1.109375 -1.019531 1.414062 -0.609375 2.03125 -0.609375 C 2.289062 -0.609375 2.609375 -0.671875 2.984375 -0.796875 L 2.984375 -0.140625 C 2.679688 -0.015625 2.34375 0.046875 1.96875 0.046875 C 1.425781 0.046875 1.007812 -0.113281 0.71875 -0.4375 C 0.4375 -0.757812 0.296875 -1.226562 0.296875 -1.84375 C 0.296875 -2.226562 0.363281 -2.566406 0.5 -2.859375 C 0.644531 -3.148438 0.847656 -3.367188 1.109375 -3.515625 C 1.378906 -3.671875 1.6875 -3.75 2.03125 -3.75 C 2.394531 -3.75 2.757812 -3.664062 3.125 -3.5 L 2.875 -2.859375 C 2.726562 -2.921875 2.582031 -2.976562 2.4375 -3.03125 C 2.300781 -3.082031 2.164062 -3.109375 2.03125 -3.109375 Z M 2.03125 -3.109375 " id="glyph16-6" x="222.941309" y="151.84167"></path></g><g><path style="stroke:none;" d="M 1.015625 -1.421875 C 1.015625 -1.140625 1.0625 -0.925781 1.15625 -0.78125 C 1.25 -0.632812 1.398438 -0.5625 1.609375 -0.5625 C 1.816406 -0.5625 1.960938 -0.632812 2.046875 -0.78125 C 2.140625 -0.925781 2.1875 -1.140625 2.1875 -1.421875 C 2.1875 -1.703125 2.140625 -1.910156 2.046875 -2.046875 C 1.960938 -2.191406 1.816406 -2.265625 1.609375 -2.265625 C 1.398438 -2.265625 1.25 -2.191406 1.15625 -2.046875 C 1.0625 -1.910156 1.015625 -1.703125 1.015625 -1.421875 Z M 2.984375 -1.421875 C 2.984375 -0.960938 2.859375 -0.601562 2.609375 -0.34375 C 2.367188 -0.0820312 2.03125 0.046875 1.59375 0.046875 C 1.320312 0.046875 1.082031 -0.0078125 0.875 -0.125 C 0.664062 -0.25 0.503906 -0.421875 0.390625 -0.640625 C 0.285156 -0.859375 0.234375 -1.117188 0.234375 -1.421875 C 0.234375 -1.878906 0.351562 -2.238281 0.59375 -2.5 C 0.832031 -2.757812 1.171875 -2.890625 1.609375 -2.890625 C 1.878906 -2.890625 2.117188 -2.828125 2.328125 -2.703125 C 2.535156 -2.585938 2.695312 -2.414062 2.8125 -2.1875 C 2.925781 -1.96875 2.984375 -1.710938 2.984375 -1.421875 Z M 2.984375 -1.421875 " id="glyph16-7" x="226.247462" y="151.84167"></path></g><g><path style="stroke:none;" d="M 3.015625 0 L 2.25 0 L 2.25 -1.65625 C 2.25 -1.851562 2.210938 -2.003906 2.140625 -2.109375 C 2.066406 -2.210938 1.953125 -2.265625 1.796875 -2.265625 C 1.578125 -2.265625 1.414062 -2.191406 1.3125 -2.046875 C 1.21875 -1.898438 1.171875 -1.660156 1.171875 -1.328125 L 1.171875 0 L 0.40625 0 L 0.40625 -2.828125 L 1 -2.828125 L 1.09375 -2.46875 L 1.140625 -2.46875 C 1.222656 -2.601562 1.335938 -2.707031 1.484375 -2.78125 C 1.640625 -2.851562 1.816406 -2.890625 2.015625 -2.890625 C 2.335938 -2.890625 2.582031 -2.796875 2.75 -2.609375 C 2.925781 -2.429688 3.015625 -2.175781 3.015625 -1.84375 Z M 3.015625 0 " id="glyph16-8" x="229.459877" y="151.84167"></path></g><g><path style="stroke:none;" d="M 1.5625 0.046875 C 0.675781 0.046875 0.234375 -0.4375 0.234375 -1.40625 C 0.234375 -1.882812 0.351562 -2.25 0.59375 -2.5 C 0.832031 -2.757812 1.175781 -2.890625 1.625 -2.890625 C 1.945312 -2.890625 2.238281 -2.820312 2.5 -2.6875 L 2.28125 -2.09375 C 2.15625 -2.144531 2.039062 -2.1875 1.9375 -2.21875 C 1.832031 -2.25 1.726562 -2.265625 1.625 -2.265625 C 1.21875 -2.265625 1.015625 -1.976562 1.015625 -1.40625 C 1.015625 -0.851562 1.21875 -0.578125 1.625 -0.578125 C 1.769531 -0.578125 1.90625 -0.59375 2.03125 -0.625 C 2.15625 -0.664062 2.285156 -0.734375 2.421875 -0.828125 L 2.421875 -0.15625 C 2.296875 -0.0820312 2.164062 -0.03125 2.03125 0 C 1.90625 0.03125 1.75 0.046875 1.5625 0.046875 Z M 1.5625 0.046875 " id="glyph16-9" x="232.869902" y="151.84167"></path></g><g><path style="stroke:none;" d="M 1.578125 -2.328125 C 1.410156 -2.328125 1.28125 -2.273438 1.1875 -2.171875 C 1.09375 -2.078125 1.039062 -1.929688 1.03125 -1.734375 L 2.125 -1.734375 C 2.113281 -1.929688 2.0625 -2.078125 1.96875 -2.171875 C 1.875 -2.273438 1.742188 -2.328125 1.578125 -2.328125 Z M 1.6875 0.046875 C 1.226562 0.046875 0.867188 -0.078125 0.609375 -0.328125 C 0.359375 -0.578125 0.234375 -0.929688 0.234375 -1.390625 C 0.234375 -1.867188 0.347656 -2.238281 0.578125 -2.5 C 0.816406 -2.757812 1.148438 -2.890625 1.578125 -2.890625 C 1.972656 -2.890625 2.28125 -2.773438 2.5 -2.546875 C 2.726562 -2.316406 2.84375 -2 2.84375 -1.59375 L 2.84375 -1.21875 L 1.015625 -1.21875 C 1.023438 -1 1.085938 -0.828125 1.203125 -0.703125 C 1.328125 -0.585938 1.5 -0.53125 1.71875 -0.53125 C 1.894531 -0.53125 2.054688 -0.546875 2.203125 -0.578125 C 2.359375 -0.609375 2.519531 -0.664062 2.6875 -0.75 L 2.6875 -0.15625 C 2.550781 -0.0820312 2.40625 -0.03125 2.25 0 C 2.09375 0.03125 1.90625 0.046875 1.6875 0.046875 Z M 1.6875 0.046875 " id="glyph16-5" x="235.537625" y="151.84167"></path></g><g><path style="stroke:none;" d="M 1.953125 0.046875 C 1.628906 0.046875 1.367188 -0.0703125 1.171875 -0.3125 L 1.140625 -0.3125 C 1.160156 -0.0703125 1.171875 0.0625 1.171875 0.09375 L 1.171875 1.25 L 0.40625 1.25 L 0.40625 -2.828125 L 1.03125 -2.828125 L 1.140625 -2.46875 L 1.171875 -2.46875 C 1.359375 -2.75 1.628906 -2.890625 1.984375 -2.890625 C 2.316406 -2.890625 2.578125 -2.757812 2.765625 -2.5 C 2.953125 -2.238281 3.046875 -1.878906 3.046875 -1.421875 C 3.046875 -1.117188 3 -0.851562 2.90625 -0.625 C 2.820312 -0.40625 2.695312 -0.238281 2.53125 -0.125 C 2.375 -0.0078125 2.179688 0.046875 1.953125 0.046875 Z M 1.734375 -2.265625 C 1.546875 -2.265625 1.40625 -2.207031 1.3125 -2.09375 C 1.226562 -1.976562 1.179688 -1.785156 1.171875 -1.515625 L 1.171875 -1.421875 C 1.171875 -1.117188 1.21875 -0.898438 1.3125 -0.765625 C 1.40625 -0.640625 1.550781 -0.578125 1.75 -0.578125 C 2.09375 -0.578125 2.265625 -0.863281 2.265625 -1.4375 C 2.265625 -1.707031 2.21875 -1.910156 2.125 -2.046875 C 2.039062 -2.191406 1.910156 -2.265625 1.734375 -2.265625 Z M 1.734375 -2.265625 " id="glyph16-10" x="238.6031" y="151.84167"></path></g><g><path style="stroke:none;" d="M 1.59375 -0.5625 C 1.726562 -0.5625 1.890625 -0.59375 2.078125 -0.65625 L 2.078125 -0.078125 C 1.890625 0.00390625 1.65625 0.046875 1.375 0.046875 C 1.0625 0.046875 0.832031 -0.03125 0.6875 -0.1875 C 0.550781 -0.34375 0.484375 -0.578125 0.484375 -0.890625 L 0.484375 -2.25 L 0.125 -2.25 L 0.125 -2.578125 L 0.546875 -2.84375 L 0.765625 -3.4375 L 1.265625 -3.4375 L 1.265625 -2.828125 L 2.046875 -2.828125 L 2.046875 -2.25 L 1.265625 -2.25 L 1.265625 -0.890625 C 1.265625 -0.773438 1.296875 -0.691406 1.359375 -0.640625 C 1.421875 -0.585938 1.5 -0.5625 1.59375 -0.5625 Z M 1.59375 -0.5625 " id="glyph16-11" x="241.886452" y="151.84167"></path></g><g><path style="stroke:none;" d="" id="glyph16-12" x="244.138689" y="151.84167"></path></g><g><path style="stroke:none;" d="M 2.203125 0 L 2.046875 -0.390625 L 2.03125 -0.390625 C 1.90625 -0.222656 1.769531 -0.109375 1.625 -0.046875 C 1.488281 0.015625 1.3125 0.046875 1.09375 0.046875 C 0.820312 0.046875 0.609375 -0.03125 0.453125 -0.1875 C 0.296875 -0.34375 0.21875 -0.5625 0.21875 -0.84375 C 0.21875 -1.144531 0.320312 -1.363281 0.53125 -1.5 C 0.738281 -1.644531 1.054688 -1.726562 1.484375 -1.75 L 1.96875 -1.765625 L 1.96875 -1.890625 C 1.96875 -2.171875 1.820312 -2.3125 1.53125 -2.3125 C 1.3125 -2.3125 1.046875 -2.242188 0.734375 -2.109375 L 0.484375 -2.640625 C 0.804688 -2.804688 1.164062 -2.890625 1.5625 -2.890625 C 1.945312 -2.890625 2.238281 -2.804688 2.4375 -2.640625 C 2.644531 -2.472656 2.75 -2.222656 2.75 -1.890625 L 2.75 0 Z M 1.96875 -1.3125 L 1.671875 -1.296875 C 1.453125 -1.296875 1.285156 -1.253906 1.171875 -1.171875 C 1.066406 -1.097656 1.015625 -0.988281 1.015625 -0.84375 C 1.015625 -0.625 1.140625 -0.515625 1.390625 -0.515625 C 1.566406 -0.515625 1.707031 -0.566406 1.8125 -0.671875 C 1.914062 -0.773438 1.96875 -0.910156 1.96875 -1.078125 Z M 1.96875 -1.3125 " id="glyph16-3" x="245.486485" y="151.84167"></path></g><g><path style="stroke:none;" d="M 3.015625 0 L 2.25 0 L 2.25 -1.65625 C 2.25 -1.851562 2.210938 -2.003906 2.140625 -2.109375 C 2.066406 -2.210938 1.953125 -2.265625 1.796875 -2.265625 C 1.578125 -2.265625 1.414062 -2.191406 1.3125 -2.046875 C 1.21875 -1.898438 1.171875 -1.660156 1.171875 -1.328125 L 1.171875 0 L 0.40625 0 L 0.40625 -2.828125 L 1 -2.828125 L 1.09375 -2.46875 L 1.140625 -2.46875 C 1.222656 -2.601562 1.335938 -2.707031 1.484375 -2.78125 C 1.640625 -2.851562 1.816406 -2.890625 2.015625 -2.890625 C 2.335938 -2.890625 2.582031 -2.796875 2.75 -2.609375 C 2.925781 -2.429688 3.015625 -2.175781 3.015625 -1.84375 Z M 3.015625 0 " id="glyph16-8" x="248.620363" y="151.84167"></path></g><g><path style="stroke:none;" d="M 1.296875 0.046875 C 0.960938 0.046875 0.703125 -0.078125 0.515625 -0.328125 C 0.328125 -0.585938 0.234375 -0.945312 0.234375 -1.40625 C 0.234375 -1.875 0.328125 -2.238281 0.515625 -2.5 C 0.710938 -2.757812 0.984375 -2.890625 1.328125 -2.890625 C 1.679688 -2.890625 1.953125 -2.75 2.140625 -2.46875 L 2.15625 -2.46875 C 2.125 -2.675781 2.109375 -2.863281 2.109375 -3.03125 L 2.109375 -3.9375 L 2.875 -3.9375 L 2.875 0 L 2.28125 0 L 2.140625 -0.375 L 2.109375 -0.375 C 1.929688 -0.09375 1.660156 0.046875 1.296875 0.046875 Z M 1.578125 -0.5625 C 1.773438 -0.5625 1.914062 -0.617188 2 -0.734375 C 2.09375 -0.847656 2.144531 -1.046875 2.15625 -1.328125 L 2.15625 -1.40625 C 2.15625 -1.707031 2.109375 -1.921875 2.015625 -2.046875 C 1.921875 -2.179688 1.769531 -2.25 1.5625 -2.25 C 1.382812 -2.25 1.25 -2.175781 1.15625 -2.03125 C 1.0625 -1.882812 1.015625 -1.675781 1.015625 -1.40625 C 1.015625 -1.125 1.0625 -0.910156 1.15625 -0.765625 C 1.25 -0.628906 1.390625 -0.5625 1.578125 -0.5625 Z M 1.578125 -0.5625 " id="glyph16-13" x="252.030388" y="151.84167"></path></g><g><path style="stroke:none;" d="" id="glyph16-12" x="255.31374" y="151.84167"></path></g><g><path style="stroke:none;" d="M 3.53125 -1.890625 C 3.53125 -1.273438 3.359375 -0.804688 3.015625 -0.484375 C 2.671875 -0.160156 2.171875 0 1.515625 0 L 0.46875 0 L 0.46875 -3.703125 L 1.625 -3.703125 C 2.226562 -3.703125 2.695312 -3.539062 3.03125 -3.21875 C 3.363281 -2.90625 3.53125 -2.460938 3.53125 -1.890625 Z M 2.71875 -1.859375 C 2.71875 -2.660156 2.367188 -3.0625 1.671875 -3.0625 L 1.25 -3.0625 L 1.25 -0.65625 L 1.59375 -0.65625 C 2.34375 -0.65625 2.71875 -1.054688 2.71875 -1.859375 Z M 2.71875 -1.859375 " id="glyph16-14" x="256.661535" y="151.84167"></path></g><g><path style="stroke:none;" d="M 1.578125 -2.328125 C 1.410156 -2.328125 1.28125 -2.273438 1.1875 -2.171875 C 1.09375 -2.078125 1.039062 -1.929688 1.03125 -1.734375 L 2.125 -1.734375 C 2.113281 -1.929688 2.0625 -2.078125 1.96875 -2.171875 C 1.875 -2.273438 1.742188 -2.328125 1.578125 -2.328125 Z M 1.6875 0.046875 C 1.226562 0.046875 0.867188 -0.078125 0.609375 -0.328125 C 0.359375 -0.578125 0.234375 -0.929688 0.234375 -1.390625 C 0.234375 -1.867188 0.347656 -2.238281 0.578125 -2.5 C 0.816406 -2.757812 1.148438 -2.890625 1.578125 -2.890625 C 1.972656 -2.890625 2.28125 -2.773438 2.5 -2.546875 C 2.726562 -2.316406 2.84375 -2 2.84375 -1.59375 L 2.84375 -1.21875 L 1.015625 -1.21875 C 1.023438 -1 1.085938 -0.828125 1.203125 -0.703125 C 1.328125 -0.585938 1.5 -0.53125 1.71875 -0.53125 C 1.894531 -0.53125 2.054688 -0.546875 2.203125 -0.578125 C 2.359375 -0.609375 2.519531 -0.664062 2.6875 -0.75 L 2.6875 -0.15625 C 2.550781 -0.0820312 2.40625 -0.03125 2.25 0 C 2.09375 0.03125 1.90625 0.046875 1.6875 0.046875 Z M 1.6875 0.046875 " id="glyph16-5" x="260.502246" y="151.84167"></path></g><g><path style="stroke:none;" d="M 2.375 -0.84375 C 2.375 -0.550781 2.273438 -0.328125 2.078125 -0.171875 C 1.878906 -0.0234375 1.578125 0.046875 1.171875 0.046875 C 0.960938 0.046875 0.785156 0.03125 0.640625 0 C 0.492188 -0.0195312 0.359375 -0.0546875 0.234375 -0.109375 L 0.234375 -0.75 C 0.378906 -0.6875 0.539062 -0.628906 0.71875 -0.578125 C 0.90625 -0.535156 1.066406 -0.515625 1.203125 -0.515625 C 1.484375 -0.515625 1.625 -0.59375 1.625 -0.75 C 1.625 -0.8125 1.601562 -0.863281 1.5625 -0.90625 C 1.519531 -0.945312 1.453125 -0.988281 1.359375 -1.03125 C 1.273438 -1.082031 1.15625 -1.140625 1 -1.203125 C 0.78125 -1.296875 0.617188 -1.378906 0.515625 -1.453125 C 0.421875 -1.535156 0.347656 -1.625 0.296875 -1.71875 C 0.253906 -1.820312 0.234375 -1.945312 0.234375 -2.09375 C 0.234375 -2.34375 0.328125 -2.535156 0.515625 -2.671875 C 0.710938 -2.816406 0.992188 -2.890625 1.359375 -2.890625 C 1.691406 -2.890625 2.019531 -2.8125 2.34375 -2.65625 L 2.125 -2.109375 C 1.976562 -2.171875 1.84375 -2.21875 1.71875 -2.25 C 1.59375 -2.289062 1.46875 -2.3125 1.34375 -2.3125 C 1.113281 -2.3125 1 -2.25 1 -2.125 C 1 -2.0625 1.035156 -2.003906 1.109375 -1.953125 C 1.179688 -1.898438 1.34375 -1.820312 1.59375 -1.71875 C 1.8125 -1.632812 1.972656 -1.550781 2.078125 -1.46875 C 2.179688 -1.394531 2.253906 -1.304688 2.296875 -1.203125 C 2.347656 -1.097656 2.375 -0.976562 2.375 -0.84375 Z M 2.375 -0.84375 " id="glyph16-4" x="263.567721" y="151.84167"></path></g><g><path style="stroke:none;" d="M 0.375 -3.5625 C 0.375 -3.8125 0.515625 -3.9375 0.796875 -3.9375 C 1.078125 -3.9375 1.21875 -3.8125 1.21875 -3.5625 C 1.21875 -3.445312 1.179688 -3.351562 1.109375 -3.28125 C 1.035156 -3.21875 0.929688 -3.1875 0.796875 -3.1875 C 0.515625 -3.1875 0.375 -3.3125 0.375 -3.5625 Z M 1.171875 0 L 0.40625 0 L 0.40625 -2.828125 L 1.171875 -2.828125 Z M 1.171875 0 " id="glyph16-15" x="266.146774" y="151.84167"></path></g><g><path style="stroke:none;" d="M 2.875 -2.828125 L 2.875 -2.4375 L 2.421875 -2.328125 C 2.503906 -2.203125 2.546875 -2.0625 2.546875 -1.90625 C 2.546875 -1.59375 2.4375 -1.351562 2.21875 -1.1875 C 2.007812 -1.019531 1.71875 -0.9375 1.34375 -0.9375 L 1.203125 -0.9375 L 1.09375 -0.953125 C 1.007812 -0.890625 0.96875 -0.820312 0.96875 -0.75 C 0.96875 -0.632812 1.113281 -0.578125 1.40625 -0.578125 L 1.875 -0.578125 C 2.1875 -0.578125 2.425781 -0.507812 2.59375 -0.375 C 2.757812 -0.25 2.84375 -0.0546875 2.84375 0.203125 C 2.84375 0.535156 2.703125 0.789062 2.421875 0.96875 C 2.148438 1.15625 1.753906 1.25 1.234375 1.25 C 0.835938 1.25 0.535156 1.175781 0.328125 1.03125 C 0.117188 0.894531 0.015625 0.707031 0.015625 0.46875 C 0.015625 0.289062 0.0664062 0.144531 0.171875 0.03125 C 0.273438 -0.0820312 0.429688 -0.164062 0.640625 -0.21875 C 0.566406 -0.25 0.5 -0.300781 0.4375 -0.375 C 0.375 -0.457031 0.34375 -0.539062 0.34375 -0.625 C 0.34375 -0.726562 0.375 -0.816406 0.4375 -0.890625 C 0.5 -0.960938 0.59375 -1.035156 0.71875 -1.109375 C 0.5625 -1.171875 0.441406 -1.269531 0.359375 -1.40625 C 0.273438 -1.550781 0.234375 -1.722656 0.234375 -1.921875 C 0.234375 -2.222656 0.332031 -2.457031 0.53125 -2.625 C 0.726562 -2.800781 1.015625 -2.890625 1.390625 -2.890625 C 1.472656 -2.890625 1.566406 -2.878906 1.671875 -2.859375 C 1.785156 -2.847656 1.851562 -2.835938 1.875 -2.828125 Z M 0.6875 0.40625 C 0.6875 0.507812 0.734375 0.585938 0.828125 0.640625 C 0.929688 0.703125 1.078125 0.734375 1.265625 0.734375 C 1.546875 0.734375 1.765625 0.695312 1.921875 0.625 C 2.078125 0.550781 2.15625 0.445312 2.15625 0.3125 C 2.15625 0.207031 2.109375 0.132812 2.015625 0.09375 C 1.921875 0.0507812 1.773438 0.03125 1.578125 0.03125 L 1.1875 0.03125 C 1.039062 0.03125 0.921875 0.0625 0.828125 0.125 C 0.734375 0.195312 0.6875 0.289062 0.6875 0.40625 Z M 0.96875 -1.90625 C 0.96875 -1.75 1 -1.625 1.0625 -1.53125 C 1.132812 -1.445312 1.242188 -1.40625 1.390625 -1.40625 C 1.535156 -1.40625 1.640625 -1.445312 1.703125 -1.53125 C 1.773438 -1.625 1.8125 -1.75 1.8125 -1.90625 C 1.8125 -2.25 1.671875 -2.421875 1.390625 -2.421875 C 1.109375 -2.421875 0.96875 -2.25 0.96875 -1.90625 Z M 0.96875 -1.90625 " id="glyph16-16" x="267.73018" y="151.84167"></path></g><g><path style="stroke:none;" d="M 3.015625 0 L 2.25 0 L 2.25 -1.65625 C 2.25 -1.851562 2.210938 -2.003906 2.140625 -2.109375 C 2.066406 -2.210938 1.953125 -2.265625 1.796875 -2.265625 C 1.578125 -2.265625 1.414062 -2.191406 1.3125 -2.046875 C 1.21875 -1.898438 1.171875 -1.660156 1.171875 -1.328125 L 1.171875 0 L 0.40625 0 L 0.40625 -2.828125 L 1 -2.828125 L 1.09375 -2.46875 L 1.140625 -2.46875 C 1.222656 -2.601562 1.335938 -2.707031 1.484375 -2.78125 C 1.640625 -2.851562 1.816406 -2.890625 2.015625 -2.890625 C 2.335938 -2.890625 2.582031 -2.796875 2.75 -2.609375 C 2.925781 -2.429688 3.015625 -2.175781 3.015625 -1.84375 Z M 3.015625 0 " id="glyph16-8" x="270.661383" y="151.84167"></path></g></g></g></svg>
banujan6 commented 10 months ago

@Fuzzyma I fixed it from my side. I checked the d value of the element and if it was empty, I skipped it from adding it to canvas. It does the job. I am okay with closing this issue.

If you feel like this no need to be fixed / not a bug a all. You can close this issue. Thanks for your time and support. :)

Fuzzyma commented 10 months ago

it definitely needs to be fixed so I will leave that open :). Thanks for reporting!