The Wayback Machine - https://web.archive.org/web/20221123123511/https://github.com/matplotlib/matplotlib/issues/20910
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

[Bug]: Exported SVG files are no longer imported Affinity Designer correctly #20910

Open
tobywise opened this issue Aug 26, 2021 · 4 comments
Open

Comments

@tobywise
Copy link

tobywise commented Aug 26, 2021

Bug summary

When importing SVG files created by Matplotlib into Affinity Designer, text characters are imported on top of one another. There are no issues importing into Inkscape, and I have not tried any other software.

Code for reproduction

# Exporting .SVG using the following code
plt.savefig('filename.svg')

Actual outcome

matplotlib_affinity_text

Expected outcome

Matplotlib SVGs were imported into Affinity Designer correctly prior to #17669 - specifically this commit 7480805

Operating system

Windows

Matplotlib Version

3.4.3

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Other libraries

No response

Installation

pip

Conda channel

No response

@tacaswell
Copy link
Member

tacaswell commented Aug 26, 2021

Thank you for bisecting this back to the exact commit!

There are no issues importing into Inkscape,

This suggests that there is a bug in Affinity Designer, have you reported this to them? We have historically held that we will not work around bugs in down-stream renderers (rsvg eventually did fix their clipping box bug).

This does look consistent with all of the along-the-text-direciton offsets being off by 1/64. I think the question we need answered is if the svg files we are producing are complaint with the SVG spec or not. If we are, I think this has to be handled on the affinity side, if we are not then it is a bug on our side.

@tobywise
Copy link
Author

tobywise commented Aug 27, 2021

Thanks for looking at this - having done a bit more investigation it seems that the problem is that AD doesn't parse the text direction offsets in the <use> tag correctly. It looks like instead of applying the offset after scaling everything 1/64, it applies it before transforming, resulting in the offset being 1/64 what it should be.

As this seems to be a bug in AD, I'll report it to them and see what happens!

@tacaswell
Copy link
Member

tacaswell commented Sep 17, 2021

@tobywise Do you have an xref to the issue with AD?

@tobywise
Copy link
Author

tobywise commented Sep 17, 2021

Here's my report on their bug reporting forum https://forum.affinity.serif.com/index.php?/topic/148539-bug-in-svg-imports/&tab=comments#comment-830429

@story645 story645 modified the milestones: unassigned, needs sorting Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants