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

Fails to handle scientific (exponential) notation #709

Closed
IronGeek opened this issue May 15, 2019 · 0 comments · Fixed by #710
Closed

Fails to handle scientific (exponential) notation #709

IronGeek opened this issue May 15, 2019 · 0 comments · Fixed by #710

Comments

@IronGeek
Copy link
Contributor

svg#toNumberArray fails to handle values using scientific (exponential) notation:

For example:
Input: -1.83697e-16 -1 1 -1.83697e-16 0 100
Expected: [-1.83697e-16, -1, 1, -1.83697e-16, 0, 100]
Actual: [-1.83697, -16, -1, 1, -1.83697, -16, 0, 100]

This cause rendering issue when the value is used, for example in a transformation:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewbox="0 0 500 500">
  <g transform="translate(10,10)">
    <rect width="200" height="200" style="stroke: black; stroke-width: 2px; fill: none;"></rect>
    <text style="font-size: 24px;" transform="matrix(-1.83697e-16 -1 1 -1.83697e-16 0 200)"> 
    <tspan x="30" y="50">Test</tspan></text>
  </g>
</svg>

canvg_svg_output

gabelerner added a commit that referenced this issue May 17, 2019
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

Successfully merging a pull request may close this issue.

1 participant