Reputation: 2991
I have created several SVG's in inkscape and saved the generated paths to my DB. When I display them on there seems to be no consistancy to their starting axis
NOTE:
Initially the problem was much worse so to fix it I set all the starting coordinates to m 10,10
(this got me to where I am now) and noticed that I can manually alter each of the letters starting X Y coordinate to place it where I want it to be, however I would like to try and understand why they are not uniform when I have defined the same starting location?
I have added preserveAspectRatio="xMinYMin meet"
and also tried every value for preserveAspectRatio but none seem to have any effect. In addition to this (after reading seeveral tutorials and SO posts) I also tried adding an additional namespace xmlns:xlink="http://www.w3.org/1999/xlink"
but this had no effect.
I would like to display all letters in the center of the viewport without manually altering each svg starting coordinates, can it be done? If the answer is no what do I need to do to be able to display them in a straight line (on the horizontal/vertical)?
below is a link to my codepen which shows problem. The charaters 'a' 'b' and 'q' are used as I think they are good examples: (note: I tried to add the 3 svg's directly to the question but it exceeded the allowed charater count)
https://codepen.io/tony-simpson/pen/jOqrabJ
Upvotes: 1
Views: 63
Reputation: 33024
You need to center the path in the middle of the svg canvas. For example for the letter A you can do:
//get the bounding box for the letter A
let bba = a.getBBox()
//translate the letter A in the middle od the svg canvas. The number 10 used representd half width or half height as in viewBox="0 0 20 20"
a.setAttribute("transform", `translate(${-bba.x -bba.width/2 + 10},${-bba.y - bba.height/2 +10})`)
svg{width:100px; outline:solid}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" preserveAspectRatio="xMinYMin meet">
<path id="a" d="m 10,10 q 0,0.0207 0,0.031 0.01033,0.0207 0.01033,0.0413 0,0.031 0.01034,0.0413 0,0.0103 0,0.0207 v 0.0103 q 0,0.0103 0,0.0207 0,0.0103 0,0.0207 0,0.0103 0.01033,-0.0103 0.02067,-0.0207 0.05168,-0.062 0.03101,-0.031 0.09302,0 0.06201,0.031 0.09302,0.0724 0.02067,0.0103 0.04134,0.031 0,-0.0103 0,-0.0207 v -0.0103 q 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.031 0,-0.0207 0,-0.0413 0,-0.0207 0,-0.0517 0,-0.0207 0,-0.0517 0,-0.0207 0,-0.062 0,-0.031 0,-0.062 0,-0.031 0,-0.0723 0,-0.031 0,-0.0724 0,-0.031 0,-0.0724 0,-0.0413 0,-0.093 0,-0.0517 -0.01034,-0.0827 -0.01033,-0.0413 -0.01033,-0.0827 0,-0.031 0,-0.0724 -0.01033,-0.0413 -0.02067,-0.0827 0,-0.0413 -0.01033,-0.093 -0.01033,-0.0413 -0.02067,-0.0827 0,-0.0413 -0.01034,-0.093 -0.01034,-0.0517 -0.02067,-0.093 -0.01034,-0.0413 -0.02067,-0.093 0,-0.0413 -0.01033,-0.093 -0.01034,-0.0517 -0.02067,-0.10335 -0.01033,-0.0413 -0.02067,-0.0827 0,-0.0517 -0.01034,-0.10335 0,-0.0517 -0.01033,-0.11369 0,-0.062 -0.02067,-0.12402 -0.01034,-0.062 -0.02067,-0.11369 -0.01033,-0.062 -0.02067,-0.11369 -0.01033,-0.0517 -0.01033,-0.11368 -0.01033,-0.062 -0.02067,-0.12403 -0.01034,-0.062 -0.02067,-0.13436 -0.01033,-0.062 -0.02067,-0.12402 -0.01034,-0.062 -0.01034,-0.12402 0,-0.062 0,-0.13436 -0.01033,-0.0724 -0.01033,-0.13436 -0.01033,-0.062 -0.01033,-0.13436 0,-0.0827 0,-0.15503 -0.01034,-0.0827 -0.02067,-0.1757 -0.01034,-0.0827 -0.02067,-0.16536 -0.01033,-0.0827 -0.01033,-0.1757 -0.01033,-0.093 -0.03101,-0.18604 -0.01033,-0.10335 -0.03101,-0.19637 -0.01034,-0.093 -0.03101,-0.18603 -0.01034,-0.093 -0.02067,-0.18604 -0.01034,-0.093 -0.02067,-0.18603 -0.01033,-0.093 -0.031,-0.18604 -0.01034,-0.093 -0.03101,-0.18603 -0.01034,-0.093 -0.02067,-0.18604 -0.02067,-0.10335 -0.03101,-0.18603 -0.01033,-0.0827 -0.02067,-0.1757 -0.01034,-0.0827 -0.02067,-0.16537 -0.02067,-0.0827 -0.04134,-0.16536 -0.01033,-0.0724 -0.03101,-0.1447 -0.01034,-0.0827 -0.04134,-0.14469 -0.02067,-0.0724 -0.04134,-0.13436 -0.02067,-0.062 -0.04134,-0.11369 -0.02067,-0.062 -0.04134,-0.12402 -0.02067,-0.0517 -0.05168,-0.11369 -0.02067,-0.062 -0.05168,-0.11369 -0.03101,-0.062 -0.06201,-0.11369 -0.03101,-0.0517 -0.05168,-0.10335 -0.03101,-0.0517 -0.05168,-0.093 -0.03101,-0.0517 -0.05168,-0.093 -0.02067,-0.0517 -0.05168,-0.093 -0.02067,-0.0413 -0.04134,-0.0827 -0.02067,-0.0413 -0.04134,-0.0724 -0.01033,-0.0413 -0.03101,-0.0724 -0.02067,-0.031 -0.04134,-0.062 -0.02067,-0.0413 -0.04134,-0.062 -0.01033,-0.0207 -0.03101,-0.0413 -0.01033,-0.0207 -0.03101,-0.0517 -0.02067,-0.031 -0.05168,-0.062 -0.03101,-0.0207 -0.05168,-0.0413 -0.02067,-0.0103 -0.04134,-0.0207 -0.02067,-0.0103 -0.05168,-0.0103 -0.03101,-0.0103 -0.06201,-0.0103 -0.03101,-0.0103 -0.04134,-0.0103 -0.01034,0 -0.02067,0 -0.01033,0 -0.03101,0.0103 -0.03101,0.0103 -0.04134,0.0103 0,0.0103 0.01033,0 0.01034,-0.0103 -0.01033,-0.0103 -0.03101,0 -0.07235,0.0103 -0.04134,0.0103 -0.06201,0.0207 -0.01033,0.0103 -0.03101,0.0103 -0.02067,0.0103 -0.05168,0.0103 -0.02067,0.0103 -0.04134,0.0207 -0.03101,0.0103 -0.06201,0.0207 -0.04134,0.0103 -0.06201,0.0207 -0.02067,0 -0.04134,0.0103 -0.02067,0.0103 -0.031,0.0207 -0.02067,0.0103 -0.03101,0.0103 -0.02067,0 -0.03101,0.0103 -0.02067,0.0103 -0.05168,0.0207 -0.02067,0.0103 -0.04134,0.0103 -0.01033,0.0103 -0.03101,0.0207 -0.01033,0.0103 -0.04134,0.0207 -0.03101,0.0207 -0.04134,0.0413 -0.02067,0.0103 -0.03101,0.0207 -0.01033,0 -0.03101,0.0207 -0.02067,0.0103 -0.04134,0.031 -0.01033,0.0103 -0.04134,0.031 -0.02067,0.0103 -0.05168,0.0413 -0.02067,0.0207 -0.04134,0.0413 -0.01034,0.0207 -0.03101,0.031 -0.01034,0.0103 -0.03101,0.031 -0.02067,0.031 -0.03101,0.0413 -0.01033,0.0207 -0.02067,0.031 -0.01033,0 -0.03101,0.0413 -0.02067,0.0414 -0.02067,0.062 0,0.0207 -0.01033,0.031 -0.02067,0.0207 -0.02067,0.031 0,0.0103 0,0.0207 -0.01033,0 -0.01033,0.0103 0,0.0103 0,0.0207 -0.01033,0.0103 -0.01033,0.031 0,0.0207 0,0.0103 0,-0.0103 -0.01034,-0.0103 0,0 -0.02067,0.031 -0.01034,0.0413 -0.02067,0.062 0,0.0103 -0.02067,0.0413 -0.02067,0.0207 -0.02067,0.0517 -0.01033,0.0207 -0.02067,0.0413 -0.02067,0.031 -0.03101,0.062 -0.01034,0.0413 -0.02067,0.0723 -0.01034,0.0207 -0.02067,0.0517 -0.01033,0.031 -0.01033,0.062 -0.01033,0.0207 -0.03101,0.062 -0.02067,0.031 -0.03101,0.0724 -0.02067,0.0413 -0.03101,0.0724 -0.01034,0.0207 -0.03101,0.062 -0.02067,0.0413 -0.04134,0.0827 -0.01034,0.0413 -0.02067,0.0724 -0.01033,0.031 -0.03101,0.062 -0.02067,0.031 -0.03101,0.062 -0.02067,0.0413 -0.03101,0.0724 -0.02067,0.0413 -0.031,0.0724 -0.02067,0.031 -0.03101,0.062 -0.01034,0.0413 -0.02067,0.062 -0.01033,0.0207 -0.03101,0.0517 -0.02067,0.031 -0.04134,0.062 -0.02067,0.031 -0.04134,0.062 -0.02067,0.031 -0.04134,0.0724 -0.02067,0.0517 -0.04134,0.0827 -0.02067,0.0413 -0.04134,0.093 -0.03101,0.0413 -0.04134,0.0723 -0.01033,0.0414 -0.031,0.0724 -0.02067,0.0207 -0.04134,0.062 -0.02067,0.031 -0.03101,0.062 -0.01034,0.031 -0.04134,0.062 -0.02067,0.0413 -0.031,0.0827 -0.02067,0.0517 -0.03101,0.0724 -0.01034,0.031 -0.02067,0.062 -0.01033,0.031 -0.02067,0.062 -0.01034,0.0413 -0.02067,0.0724 -0.01033,0.031 -0.02067,0.062 -0.02067,0.031 -0.031,0.0724 -0.02067,0.0413 -0.04134,0.093 -0.03101,0.0413 -0.05168,0.093 -0.02067,0.0517 -0.04134,0.10335 -0.01033,0.0413 -0.03101,0.0827 -0.01033,0.0413 -0.03101,0.093 -0.03101,0.0413 -0.04134,0.093 -0.01033,0.0413 -0.02067,0.0724 -0.01033,0.0413 -0.031,0.0827 -0.02067,0.0413 -0.04134,0.0724 -0.01033,0.031 -0.03101,0.0827 -0.03101,0.0413 -0.04134,0.0724 -0.01033,0.0413 -0.031,0.0827 -0.01034,0.0413 -0.02067,0.0827 -0.02067,0.0413 -0.02067,0.0724 -0.01033,0.031 -0.02067,0.0517 -0.01034,0.031 -0.03101,0.062 -0.01033,0.0413 -0.02067,0.0723 0,0.0207 -0.01034,0.0413 -0.01033,0.0103 -0.03101,0.0517 -0.02067,0.0413 -0.03101,0.0827 -0.01033,0.031 -0.02067,0.0517 0,0.0103 -0.02067,0.0413 -0.01033,0.031 -0.02067,0.062 -0.01034,0.031 -0.03101,0.0517 -0.02067,0.0207 -0.03101,0.062 -0.02067,0.031 -0.04134,0.0724 -0.02067,0.0413 -0.03101,0.0723 -0.01033,0.031 -0.02067,0.062 -0.02067,0.0207 -0.03101,0.062 -0.02067,0.031 -0.031,0.062 -0.01034,0.0207 -0.03101,0.0517 -0.01034,0.031 -0.02067,0.062 -0.01033,0.031 -0.03101,0.062 -0.01033,0.031 -0.02067,0.0724 0,0.0413 0,0.0517 0,0.0207 -0.01034,0.031 -0.01033,0.0207 -0.02067,0.0517 0,0.031 0,0.0413 -0.01033,0.0103 -0.02067,0.031 0,0.0207 -0.01033,0.0413 -0.01033,0.0207 -0.02067,0.0413 -0.02067,0.0207 -0.02067,0.0414 -0.01033,0.0207 -0.01033,0.031 0,0.0103 -0.01034,0.0207 -0.01033,0.0207 -0.02067,0.0517 -0.02067,0.0413 -0.01034,0.0517 0,0.0207 -0.01033,0.0103 v 0.0103 q 0,0.0103 -0.01033,0.0207 -0.01033,0.0103 -0.02067,0.0517 -0.02067,0.031 -0.02067,0.0413 0,0.0103 -0.01034,0.031 0,0.0103 -0.02067,0.031 -0.01033,0.0207 -0.02067,0.0517 -0.01033,0.031 -0.02067,0.0517 -0.01034,0.031 -0.02067,0.0517 -0.01033,0.0207 -0.02067,0.031 -0.01034,0.0207 -0.02067,0.062 -0.02067,0.0413 -0.01033,0.0517 0,0.0207 -0.01034,0.031 -0.01033,0.0207 -0.02067,0.062 -0.01034,0.0413 0,0.0413 0,0.0103 -0.01034,0.031 0,0.0207 0,0.031 0,0.0103 -0.01034,0.031 0,0.0207 0,0.0517 -0.01033,0.031 0,0.0207 l -0.01033,0.0103 q 0,0.0103 0,0.0413 -0.01033,0.031 -0.01033,0.0413 0,0.0103 0,0.0207 0,0.0103 0,0.0207 0,0.0103 0.01033,0 0.01033,-0.0207 0,-0.0103 -0.01033,0.0103 -0.02067,0.0517 -0.01033,0.0413 -0.01033,0.0517 0,0.0103 0,0.0207 0,0.0207 0,0.031 0,0.0103 0,0.0207 0,0.0103 0,0.0103 0,0.0103 0,0.0207 0,0.0103 0,0.0207 0,0.0103 0,0.0207 v 0.0103 q 0,0.0103 0,0.0207 0,0.0103 0,0.0207 0,0.0103 0,0.0103 0,0.0103 0,0.0207 v 0.0103 q 0,0.0103 0,0.0207 0.02067,0.031 0.04134,0.0517 0.04134,0.0413 0.08268,0.0827 0.05168,0.0413 0.01033,0 -0.03101,-0.0413 -0.07235,-0.0724 -0.04134,-0.0413 0.04134,-0.031 0.08268,0 0.113688,0.0413 0.04134,0.031 0.05168,0.031 0.02067,-0.0207 0.04134,-0.0413 0.04134,-0.0413 0.04134,-0.0517 -0.02067,-0.0207 -0.04134,-0.0414 -0.02067,-0.0207 -0.04134,-0.0517 -0.01034,0 0.031,0.0413 0.04134,0.031 0,0.0724 -0.04134,0.031 -0.07235,0.0723 -0.03101,0.0413 -0.06201,0.0207 -0.03101,-0.0207 0,-0.0207 0.03101,0 0.07235,0.0207 0.03101,0.0103 0.02067,0.0207 -0.02067,0.0103 0.01034,0 0.02067,-0.0103 0.031,-0.0103 0,-0.0103 -0.01033,0 -0.01033,0.0103 -0.04134,-0.031 -0.04134,-0.0413 -0.06201,-0.0413 -0.02067,0 -0.02067,0.0103 h 0.01033 q 0,0.0103 0.08268,0.0103 0.08268,0.0103 0.06201,-0.031 -0.01033,-0.031 -0.07235,0 -0.06201,0.0413 -0.04134,0.0723 0.02067,0.031 0.05168,0.0517 0.04134,0.0103 0.08268,0.0103 0.04134,-0.0103 0.07235,-0.031 0.031,-0.031 0.05168,-0.062 0.01033,-0.0413 0.01033,-0.0827 -0.01033,-0.0414 -0.03101,-0.0724 -0.031,-0.031 -0.02067,0 0.01033,0.0207 -0.05168,0.0517 -0.06201,0.031 -0.08268,0 -0.01033,-0.031 0.06201,-0.031 0.07235,0 0.07235,-0.0103 v -0.0103 q -0.01033,0 -0.03101,-0.0207 -0.02067,-0.0103 -0.07235,-0.0517 -0.04134,-0.0413 -0.07235,-0.031 -0.02067,0.0103 -0.04134,0.0103 -0.01033,0.0103 0.01034,0 0.02067,-0.0103 -0.01034,0 -0.03101,0.0103 0,0.031 0.02067,0.0207 0.04134,0 0.02067,-0.0103 -0.02067,-0.031 -0.03101,-0.0207 -0.08268,0.0207 -0.04134,0.0413 -0.08268,0.0827 -0.04134,0.0413 0,0.093 0.02067,0.0207 0.04134,0.0413 0.01033,0 -0.03101,-0.0413 -0.02067,-0.0103 -0.04134,-0.031 0,0.0103 0.04134,-0.031 0.04134,-0.031 0.03101,-0.031 0.02067,0.0207 0.04134,0.0413 0.04134,0.0413 0.113688,0.0413 0.08268,-0.0103 0.04134,-0.0517 -0.04134,-0.0413 -0.08268,-0.0827 -0.04134,-0.0413 -0.01034,0 0.03101,0.0413 0.07235,0.0723 0.02067,0.0207 0.04134,0.031 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 0,0 0,-0.0103 v -0.0103 q 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 0,0 0,-0.0103 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 v -0.0103 q 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.031 0,-0.0103 0,-0.0207 0,-0.0103 -0.01033,0 -0.01034,0.0207 0,0.0103 0.01033,-0.0207 0.02067,-0.0517 0.01034,-0.0413 0.01034,-0.0517 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 0,-0.0103 -0.01034,0 0,0 0.01034,-0.0207 0,-0.0103 0.01033,-0.031 0,-0.031 0,-0.0413 0,-0.0103 0,-0.0207 0.01034,-0.0207 0.01034,-0.031 0,-0.0207 0,-0.0414 0.01033,-0.0207 0.01033,-0.0517 0,-0.0207 -0.01033,-0.0207 0.01033,0 0.01033,-0.0103 0.01034,-0.0207 0.01034,-0.0413 0,-0.0207 0.01033,-0.0207 0,-0.0103 0.01033,-0.031 0.02067,-0.0207 0.03101,-0.0413 0.01033,-0.031 0.02067,-0.062 0.01034,-0.0207 0.02067,-0.0413 0.01034,-0.031 0.02067,-0.0413 0.01033,-0.0207 0.02067,-0.0517 0.01034,-0.0207 0.02067,-0.0517 0,-0.0207 0.01033,-0.031 -0.01033,-0.0103 0,-0.0207 0.01034,0 0.02067,-0.031 0.02067,-0.031 0.02067,-0.0517 0.01034,-0.0207 0.01034,-0.0413 0,-0.0207 0,-0.0103 l 0.01034,-0.0103 q 0.01033,-0.0207 0.02067,-0.0414 0.01033,-0.031 0.01033,-0.0413 0,-0.0103 0.01033,-0.0207 0.01033,-0.0207 0.02067,-0.0413 0.02067,-0.031 0.03101,-0.062 0.01034,-0.031 0.02067,-0.0517 0,-0.031 0.01033,-0.0517 0,-0.0207 0.01034,-0.0517 0.01033,-0.031 0.02067,-0.062 0,-0.031 0,-0.0413 0,-0.0103 0.01034,-0.031 0.01033,-0.0207 0.02067,-0.0413 0.01034,-0.0207 0.02067,-0.0517 0.02067,-0.031 0.03101,-0.062 0.01034,-0.031 0.02067,-0.0517 0.02067,-0.031 0.04134,-0.0724 0.01034,-0.031 0.02067,-0.0724 0.01033,-0.031 0.03101,-0.062 0.01033,-0.0207 0.02067,-0.0413 0.01034,-0.031 0.04134,-0.062 0.02067,-0.0413 0.031,-0.0724 0.01034,-0.0413 0.03101,-0.062 0.01034,-0.031 0.03101,-0.0724 0.01033,-0.0413 0.02067,-0.062 0,-0.031 0.01033,-0.0413 0.01034,-0.0207 0.03101,-0.062 0.02067,-0.031 0.03101,-0.062 0,-0.031 0.02067,-0.062 0.01034,-0.0207 0.02067,-0.062 0.02067,-0.0413 0.03101,-0.0723 0.01033,-0.031 0.02067,-0.0724 0.01034,-0.0413 0.02067,-0.0724 0.02067,-0.0413 0.02067,-0.062 0.01034,-0.031 0.03101,-0.0724 0.02067,-0.031 0.04134,-0.0723 0.01034,-0.031 0.03101,-0.0827 0.03101,-0.0413 0.04134,-0.093 0.02067,-0.0414 0.03101,-0.0827 0.01034,-0.0413 0.03101,-0.0827 0.02067,-0.0413 0.04134,-0.093 0.01034,-0.0413 0.03101,-0.0827 0.01033,-0.0413 0.03101,-0.0827 0.02067,-0.0413 0.05168,-0.093 0.02067,-0.0517 0.04134,-0.10335 0.02067,-0.0413 0.031,-0.0827 0.02067,-0.0413 0.03101,-0.0724 0.01034,-0.0413 0.02067,-0.0724 0.01033,-0.031 0.02067,-0.062 0.01034,-0.031 0.02067,-0.062 0.01033,-0.031 0.02067,-0.0517 0,-0.031 0.02067,-0.0517 0.02067,-0.031 0.04134,-0.062 0.02067,-0.0413 0.03101,-0.0723 0.01033,-0.0207 0.03101,-0.062 0.03101,-0.031 0.04134,-0.0724 0.02067,-0.0413 0.04134,-0.0827 0.02067,-0.031 0.04134,-0.0724 0.02067,-0.0413 0.04134,-0.0827 0.02067,-0.031 0.04134,-0.062 0.02067,-0.031 0.03101,-0.0724 0.02067,-0.031 0.04134,-0.062 0.02067,-0.031 0.04134,-0.0724 0.02067,-0.0413 0.03101,-0.0724 0.01033,-0.031 0.03101,-0.062 0.01033,-0.0207 0.031,-0.062 0.01034,-0.0413 0.03101,-0.0724 0.01034,-0.031 0.03101,-0.062 0.01034,-0.031 0.03101,-0.0827 0.02067,-0.0413 0.03101,-0.0724 0,-0.031 0.02067,-0.062 0.02067,-0.031 0.04134,-0.0724 0.02067,-0.0413 0.031,-0.0827 0.01034,-0.031 0.03101,-0.062 0.02067,-0.031 0.03101,-0.0724 0.01033,-0.0413 0.02067,-0.0724 0.01033,-0.031 0.03101,-0.0723 0.01033,-0.031 0.01033,-0.0517 0,-0.0207 0.01033,-0.0413 0.02067,-0.0207 0.02067,-0.0517 0.01033,-0.0207 0.03101,-0.0413 0.01034,-0.0207 0.02067,-0.0413 0,-0.0103 0,-0.0207 0.01033,-0.0103 0.02067,-0.0207 0.01033,-0.0207 0.03101,-0.062 0.01033,-0.0413 0.01033,-0.0517 -0.01033,0 0,-0.0103 0,-0.0103 0,-0.0103 0,-0.0103 0.01033,-0.0207 0,-0.0103 0,-0.0207 0,-0.0103 0.02067,-0.0207 0.01033,-0.0207 0,-0.031 0,-0.0103 0,0 0,0.0207 0.01033,0 0.02067,-0.0103 0.03101,-0.031 0,-0.0103 0.02067,-0.0207 0.01034,-0.0103 0.02067,-0.031 0.02067,-0.0207 0.04134,-0.0413 0.01033,-0.0207 0.02067,-0.0207 0,-0.0103 0.02067,-0.0207 0.01034,0 0.04134,-0.0207 0.02067,-0.0207 0.05168,-0.0413 0.02067,-0.0103 0.04134,-0.031 0.02067,-0.0103 0.02067,-0.0207 l 0.01033,-0.0103 q 0.01033,-0.0103 0.02067,-0.0103 0.02067,0 0.03101,-0.0103 0.01034,-0.0103 0.02067,-0.0103 0.01033,-0.0103 0.02067,-0.0103 0.01034,0 0.04134,-0.0103 0.03101,-0.0103 0.05168,-0.0207 0.01033,-0.0103 0.03101,-0.0207 0.02067,-0.0103 0.03101,-0.0103 0.02067,-0.0103 0.04134,-0.0103 0.03101,-0.0103 0.06201,-0.0207 0.03101,-0.0103 0.04134,-0.0103 0.02067,-0.0103 0.04134,-0.0103 0.02067,-0.0103 0.04134,-0.0207 0.03101,-0.0103 0.04134,-0.0103 0.01033,-0.0103 0.02067,0 0.02067,-0.0103 0.04134,-0.0103 0.01033,0 0.03101,-0.0103 0.01033,-0.0103 -0.01034,0 -0.02067,0.0103 -0.01033,0.0103 0.01033,0 0.02067,0 0.01033,0 0.02067,0 0,-0.0103 -0.01033,-0.0103 -0.01033,0 0.01033,0.0103 0.01034,0.0103 0.02067,0.0103 h 0.01034 q 0,0.0103 0,0.0207 0,0 0.02067,0.0207 0.01033,0.031 0.03101,0.0517 0.01033,0.0207 0.031,0.0517 0.02067,0.031 0.03101,0.0517 0.02067,0.031 0.03101,0.062 0.02067,0.0207 0.04134,0.0724 0.02067,0.0413 0.05168,0.093 0.02067,0.0413 0.04134,0.0827 0.02067,0.0413 0.05168,0.093 0.02067,0.0517 0.05168,0.10335 0.03101,0.0517 0.06201,0.10335 0.031,0.0517 0.05168,0.093 0.02067,0.0517 0.04134,0.10335 0.02067,0.0517 0.04134,0.10336 0.02067,0.0517 0.04134,0.11368 0.02067,0.062 0.04134,0.11369 0.02067,0.062 0.04134,0.12403 0.02067,0.0517 0.04134,0.12402 0.01033,0.0724 0.03101,0.14469 0.01033,0.0724 0.03101,0.1447 0.01033,0.0827 0.02067,0.16536 0.01033,0.0724 0.02067,0.16537 0.01033,0.093 0.03101,0.18603 0.01034,0.093 0.02067,0.18604 0.01033,0.093 0.03101,0.18603 0.01034,0.093 0.02067,0.18604 0.01033,0.093 0.02067,0.18603 0.01033,0.10335 0.03101,0.19637 0.02067,0.093 0.03101,0.18604 0.02067,0.093 0.03101,0.18603 0.02067,0.093 0.02067,0.18604 0.01034,0.0827 0.02067,0.1757 0.01033,0.0827 0.02067,0.16536 0.01034,0.0827 0.01034,0.15503 0.01033,0.062 0.01033,0.1447 0,0.0723 0,0.14469 0.01033,0.0724 0.01033,0.13436 0.01034,0.062 0.01034,0.13436 0,0.062 0.01033,0.13436 0.01034,0.0827 0.02067,0.14469 0.01034,0.0724 0.02067,0.12402 0.01033,0.062 0.02067,0.12403 0,0.062 0.01033,0.12402 0.01033,0.062 0.02067,0.11369 0.01034,0.062 0.02067,0.11369 0.01033,0.0517 0.02067,0.10335 0,0.062 0.01033,0.11369 0,0.0517 0.01033,0.10335 0,0.062 0.01034,0.11369 0.02067,0.0517 0.03101,0.10335 0.01034,0.0413 0.01034,0.093 0.01033,0.0413 0.02067,0.093 0.01033,0.0517 0.02067,0.093 0.01034,0.0414 0.01034,0.0827 0.01033,0.0517 0.02067,0.093 0.01033,0.0413 0.01033,0.0827 0.01033,0.031 0.01033,0.062 0.01034,0.031 0.01034,0.0723 0,0.0517 0.01034,0.093 0.01033,0.031 0.01033,0.062 0,0.031 0,0.0724 0,0.0413 0,0.0724 0,0.0413 0,0.0724 0,0.0413 0,0.0723 0,0.031 0,0.062 0,0.0413 0,0.062 0,0.031 0,0.0517 0,0.031 0,0.0517 0,0.0207 0,0.0413 0,0.0207 0,0.031 0,0.0103 0,0.0207 0,0.0103 0,0.0207 0,0.0103 0,0.0103 0,0.0103 0,0.0207 0.01033,0.0207 0.03101,0.0413 0.04134,0.0413 0.113688,0.0724 0.07235,0.0413 0.113688,-0.0103 0.04134,-0.0413 0.06201,-0.0827 0.01034,-0.0413 0.01034,-0.0517 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0414 0,-0.0207 -0.01034,-0.0413 0,-0.0103 0,-0.031 0,-0.0103 -0.01033,-0.0517 0,-0.031 -0.01034,-0.0517 0,-0.0207 -0.02067,-0.062 -0.02067,-0.031 -0.05168,-0.0517 -0.03101,-0.031 -0.07235,-0.031 -0.04134,0 -0.08268,0.0207 -0.03101,0.0207 -0.06201,0.0517 z m 0.981852,-3.58634 q 0.04134,-0.031 0.07235,-0.0724 0.03101,-0.0413 0.02067,-0.0413 -0.02067,0 -0.04134,0.0103 -0.02067,0 -0.02067,0.0103 -0.01033,0 -0.02067,0 -0.01033,-0.0103 -0.03101,-0.0103 -0.03101,0.0103 -0.07235,0.0103 -0.03101,0 -0.08268,0.0103 -0.04134,0.0103 -0.08268,0.0207 -0.05168,0 -0.113688,0.0103 -0.05168,0.0103 -0.113688,0.0207 -0.06201,0.0103 -0.144694,0.0207 -0.07235,0.0103 -0.165365,0.0207 -0.09302,0.0103 -0.186035,0.0207 -0.09302,0.0103 -0.186035,0.031 -0.103353,0.0103 -0.206706,0.0207 -0.09302,0.0207 -0.206706,0.031 -0.113688,0 -0.227376,0.0103 -0.113688,0.0207 -0.217041,0.031 -0.113688,0.0103 -0.227376,0.0207 -0.113688,0.0103 -0.227377,0.0207 -0.124023,0.0207 -0.248046,0.031 -0.113689,0.0103 -0.237712,0.0207 -0.113688,0.0103 -0.237712,0.0207 -0.124023,0.0103 -0.237711,0.0103 -0.113688,0.0103 -0.227376,0.0207 -0.113689,0.0103 -0.227377,0.0103 -0.103353,0 -0.206705,0 -0.09302,0 -0.1757,-0.0103 -0.08268,0 -0.165365,0 -0.07235,0 -0.134359,0 -0.06201,-0.0103 -0.134358,-0.0103 -0.07235,-0.0103 -0.124024,-0.0103 -0.06201,0 -0.113688,0 -0.05168,0 -0.103353,0 -0.04134,0 -0.103353,0.0103 -0.05168,0 -0.103352,0 -0.04134,0.0103 -0.08268,0.0103 -0.04134,0.0103 -0.06201,0.0103 -0.03101,0.0103 -0.06201,0.0103 -0.04134,0 -0.07235,0 -0.04134,0.0103 -0.07235,0.0207 -0.02067,0 -0.04134,0.0103 -0.02067,0 -0.04134,0.0103 -0.03101,0.0103 -0.03101,0.0207 0.01034,0 0,0 0,-0.0103 -0.03101,0.0103 -0.03101,0.0103 -0.06201,0.031 -0.02067,0.0103 -0.04134,0.0517 -0.02067,0.0413 -0.03101,0.0724 0,0.0103 0,0.0207 0,0.0103 0,0.0207 0,0.0103 0,0.0207 0,0.0103 0.01033,0.0517 0.01034,0.0413 0.03101,0.0723 0.03101,0.031 0.07235,0.0413 0.04134,0.0103 0.08268,0 0.04134,-0.0103 0.06201,-0.0413 0.03101,-0.031 0.04134,-0.0723 0.01034,-0.0413 0.01034,-0.0517 0,-0.0103 0,-0.0207 0,-0.0103 0,-0.0207 0,0.0103 0,0.0207 -0.01034,0.0207 -0.02067,0.0413 -0.01033,0.0207 -0.02067,0.031 -0.02067,0.0103 -0.03101,0.0207 -0.01034,0 0.01033,0 0.02067,-0.0103 0.04134,-0.0207 0.01033,0 0.02067,-0.0103 -0.01034,0.0103 0.01034,0 0.02067,0 0.04134,-0.0103 0.02067,-0.0103 0.03101,-0.0103 0.02067,0 0.05168,0 0.03101,0 0.06201,0 0.04134,-0.0103 0.08268,-0.0103 0.04134,-0.0103 0.08268,-0.0103 0.04134,-0.0103 0.08268,-0.0103 0.04134,0 0.08268,0 0.05168,0 0.103353,0 0.05168,0 0.103353,0 0.05168,0 0.113688,0 0.07235,0.0103 0.134359,0.0103 0.07235,0.0103 0.144694,0.0103 0.08268,0 0.165364,0 0.09302,0 0.186036,0 0.103352,0 0.217041,0 0.113688,0 0.227376,0 0.124023,-0.0103 0.237711,-0.0207 0.113689,-0.0103 0.237712,-0.0207 0.124023,0 0.248047,-0.0103 0.124023,-0.0207 0.237711,-0.031 0.124024,-0.0103 0.248047,-0.0207 0.113688,-0.0103 0.227377,-0.0207 0.113688,-0.0207 0.227376,-0.031 0.113688,-0.0103 0.217041,-0.0207 0.113688,-0.0103 0.227376,-0.0207 0.113688,-0.0103 0.217041,-0.0207 0.103353,-0.0207 0.206706,-0.031 0.09302,-0.0103 0.186035,-0.0207 0.09302,-0.0207 0.1757,-0.031 0.09302,-0.0103 0.1757,-0.0207 0.08268,0 0.144694,-0.0207 0.07235,-0.0103 0.124023,-0.0207 0.06201,0 0.103353,-0.0103 0.05168,-0.0103 0.09302,-0.0207 0.04134,0 0.07235,-0.0103 0.02067,0 0.04134,0 0.01033,0 0.04134,0 0.03101,0 0.06201,-0.0103 0.03101,0 0.03101,-0.0103 h -0.01034 q -0.01033,0 0.04134,-0.031 0.04134,-0.0413 0.08268,-0.093 0.04134,-0.0413 0.03101,-0.0827 -0.01034,-0.0413 -0.04134,-0.0724 -0.031,-0.031 -0.07235,-0.0413 -0.04134,-0.0103 -0.07235,0 -0.04134,0.0103 -0.07235,0.0413 z"></path>
</svg>
Extending this to all your paths you can do
let paths = document.querySelectorAll("svg path")
paths.forEach(p=>{
let bb = p.getBBox()
p.setAttribute("transform", `translate(${-bb.x -bb.width/2 + 10},${-bb.y - bb.height/2 +10})`)
})
In my code I've changed the svg width to 100 because I wanted to see the path. You can change it back to what you need. You can also delete the border. In order to understand what happens please consider adding a border or outline to your svg elements.
Upvotes: 2