-
Notifications
You must be signed in to change notification settings - Fork 269
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
Problems rendering arcs in SVGs #358
Comments
I had a look at this bug this morning, but I couldn' figure it out so far... Ping @torque if ever you have some time to look at this 😊 |
While I haven't found the fix yet, I have isolated a minimal SVG file reproducing this bug: <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100" style="border: solid 1px">
<path d="M 15, 40 v -5 h -5 Z m 10, 15 A 20, 20, 0, 0, 0, 35, 35 Z" fill="blue"/>
<!-- Display some points to help debugging: -->
<circle r="1" cx="15" cy="40" fill="green"/> <!-- starting point -->
<circle r="1" cx="15" cy="35" fill="green"/> <!-- position after the vertical shift -->
<circle r="1" cx="10" cy="35" fill="green"/> <!-- position after the horizontal shift -->
<circle r="1" cx="20" cy="50" fill="yellow"/> <!-- the expected arc start -->
<circle r="1" cx="25" cy="55" fill="purple"/> <!-- the actual arc start when rendered in a web browser -->
<circle r="1" cx="35" cy="35" fill="green"/> <!-- end path position -->
</svg> How it is rendered by a web browser can be compared to how #!/usr/bin/env python3
import fpdf
pdf = fpdf.FPDF()
pdf.add_page()
pdf.image("issue_358.svg")
pdf.rect(x=10, y=10, w=100, h=100)
pdf.output("issue_358.pdf") What really amazes me, and makes this bug quite mysterious, is that the numeric values after the |
Scalable Vector Graphics (SVG) 2, 9.3.4. the "closepath" command says this:
It is not stated very explicitly, but that seems to imply that the current position should be moved along as well. Edit: |
Yes, this quote from https://www.w3.org/TR/SVG/paths.html#TermInitialPoint enlightened me:
I opened #362 to fix this |
Many thanks @Lucas-C and @gmischler for fixing this bug! |
Adding SVG with content:
results in "broken" arcs.
I am using Python 3.9.2 with the latest version of the master fpdf2 branch (2.5.1)
The text was updated successfully, but these errors were encountered: