-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: Exported SVG files are no longer imported Affinity Designer correctly #20910
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
Comments
Thank you for bisecting this back to the exact commit!
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. |
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 As this seems to be a bug in AD, I'll report it to them and see what happens! |
@tobywise Do you have an xref to the issue with AD? |
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 |
This seems to be still an issue in latest versions of matplotlib and Affinity Designer.
I'd be happy to contribute a PR (it should be a matter of changing no more than 10 lines in |
Thanks for the suggestion. Do you have any documentation / specification links which prove that the suggested changes are equally valid (or ideally even preferred)? We should tailor our output to a specification not to what some individual program has implemented. Otherwise there's a risk of breaking the use in other programs. |
Thanks for the prompt reply! I agree that it is best to follow the spec rather than chase down bugs of individual editors. However, I think there might be an argument for both changes. I have done some digging in the docs and the mpl code, and here are my findings. FontWhile both ways are supported in CSS, the mozilla svg docs seem to separate
Since setting xlink:hrefSimilar case for To me this issue seems more of an Affinity shortcoming (it seems to work fine on inkscape and most browsers). However, this is the behaviour people are most likely to run into because it is the default way in which the svg backend currently renders axes lables and ticklables. More specifically, current the svg backend in
while it uses
Since both behaviours are equivalent according to the docs and present in the current matplotlib implementation, I could see an argument to have Let me know your thoughs! :) |
Thanks for the reseach work. This sounds reasonable to me and I'll support a change. However, I'd like to have a second opinion from another core dev. |
I think there are 3 proposed changes:
|
Sounds good to me! I'm happy to hold off on |
They were merged in 3.5: #19253 |
I have a slight worry that there is a bug the other way where some program does not like the many-entry. I have a vague memory of some svg tests where the weight was wrong when generating the baseline on some platforms that we fixed by re-generating to get the single-string version of the font. |
That was a special-casing in our converter, not the external program: effefaf |
ah, I am glad I miss-remember there! |
I found some time to work on the PR and update the check in the converter higlighted before. Some tests failed on azure because of a timeout on the interactive backend (which I don't think should be affected by the changes?), but all the svg-related tests seem to be passing, and now all the test images open correctly in the latest version of Affinity Designer 2. |
@LorenzoPeri17 just wanted to say thank you for figuring out a fix for this - I've been using awkward workarounds for the past 3 years! |
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
Actual outcome
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
The text was updated successfully, but these errors were encountered: