Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"y" in "tspan" interpreted as relative coordinate? #81

Closed
jdugge opened this issue Apr 8, 2017 · 2 comments
Closed

"y" in "tspan" interpreted as relative coordinate? #81

jdugge opened this issue Apr 8, 2017 · 2 comments

Comments

@jdugge
Copy link

jdugge commented Apr 8, 2017

I tried to convert an SVG that contains the following text node, which contains a y key both in the text tag and in the tspan code:

  <text
     id="text125"
     data-bb="18"
     style="font-family: &quot;Open Sans&quot;, verdana, arial, sans-serif; font-size: 12px; fill: rgb(68, 68, 68); fill-opacity: 1; visibility: inherit; white-space: pre;"
     transform="translate(24.66,0)"
     y="234"  // y is defined here...
     x="0"
     text-anchor="middle">
    <tspan
       id="tspan121"
       y="234"  // ... and here again
       x="0"
       dy="0em"
       class="line">Oct 6</tspan>
    <tspan
       id="tspan123"
       y="234"
       x="0"
       dy="1.3em"
       class="line">2013</tspan>
  </text>

This node disappears off the page when converting it using svg2pdf, presumably because in https://github.com/deeplook/svglib/blob/master/svglib/svglib.py#L720, the y coordinates are added. If I understand correctly, the inner y keyword should be interpreted as an absolute coordinate though, so the outer y should be ignored in this case.

plot.svg.txt

claudep added a commit to claudep/svglib that referenced this issue Apr 9, 2017
@claudep
Copy link
Collaborator

claudep commented Apr 9, 2017

The result is still not perfect because em units are not implemented yet, but the y position should be correct with the patch.

@jdugge
Copy link
Author

jdugge commented Apr 12, 2017

Thank you so much @claudep for the super fast help, and @deeplook for maintaining this project! Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants