Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Changes in SVG backend to improve compatibility with Affinity designer#28504
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thank you for opening your first PR into Matplotlib!
If you have not heard from us in a week or so, please leave a new comment below and that should bring it to our attention. Most of our reviewers are volunteers and sometimes things fall through the cracks.
You can also join uson gitter for real-time discussion.
For details on testing, writing docs, and our review process, please seethe developer guide
We strive to be a welcoming and open project. Please follow ourCode of Conduct.
Did you mean to close this? I noticed that tests were not passing, but were all failing in the same way, so not sure what the fix is, but it may be relatively easy to do, and we can do it within the same PR. |
Hi! Thanks for the message. I realized I read about the issue I was having in |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -433,7 +432,7 @@ def test_mathtext_fallback_invalid(): | |||
@pytest.mark.parametrize( | |||
"fallback,fontlist", | |||
[("cm", ['DejaVu Sans', 'mpltest', 'STIXGeneral', 'cmr10', 'STIXGeneral']), | |||
("stix", ['DejaVu Sans', 'mpltest', 'STIXGeneral'])]) | |||
("stix", ['DejaVu Sans', 'mpltest', 'STIXGeneral', 'STIXGeneral', 'STIXGeneral'])]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Why do we need the additional 'STIXGeneral' entries here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I have slightly changed the logic for how thetspan
s inside atext
tag are separated (backend_svg.py::_draw_text_as_text
line 1224 onwards).
During some testing I found poor compatibility with specifying multiplex
andy
in the sametspan
(from readingthe docs maybedx
would be better if the old way was to be preferred?)
My new solution is cleaner code-wise and seems to resolve the compatibility issues. However, it causes moretspans
to be generates, hence why the repetition in the tests.
To check we need to regenerate the svg files to make keep them in sync with our compare code, not because rendered output (in compliant viewers) actually changed? |
Exactly. That and because on the appveyor tests (and only there, azure and github were passung just fine) for some reason a few tests would fail with a very small RMS (~0.001) because of a few pixels in long ticklabels beingslightly off when rendering (see attached example) |
The appeveyor failures look related and real. |
I had some time to debug the failing tests. It seems that the baseline images were specifying certain coordinates for |
Can you please rebase on main and squash all of the image updating into one commit? |
At some point we change from outputting a lot of digits to rounding to a smaller number of digits but did not bulk re-generate the test images because they were still passing. |
Should be done :) |
lib/matplotlib/font_manager.py Outdated
@@ -266,8 +266,11 @@ def _get_fontconfig_fonts(): | |||
@lru_cache | |||
def _get_macos_fonts(): | |||
"""Cache and list the font paths known to ``system_profiler SPFontsDataType``.""" | |||
d, = plistlib.loads( | |||
subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"])) | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Was this change supposed to be included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Apologies, that slipped in when squasing. Fixed now
It looks like there is still a merge from main in here? |
1f1b6e0
to0e7f73d
CompareIs this OK now? |
no, still a rouge merge from main...is your local main not equal to upstream main? |
…SVG._draw_text_as_pathfixed linting (flake8 test failing)Fixed checks in testing for svg.fonttype = nonefixed flake8 && failing testslintingmodified tspans && fix to svg testsUpdated baseline images for svg testsUpdate lib/matplotlib/testing/compare.pynicer regex to check if font syling in svg is specifiedCo-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>Apply suggestions from code reviewMore concise font testing in test_backend_svg.pyCo-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>Update lib/matplotlib/tests/test_mathtext.pyCo-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>Update backend_svg.pyinlining `style`restored test imagesupdate to baseline imagesFix to regex for testing/compare.py::compareforgot one baseline image
Gotcha! It is done now, I didn't realize I had to rebase, not merge upstream main. I was doing it though the nice green button on the github page, but that only offers the option to do a merge. |
bcfecca
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
Thank you for your work on this@LorenzoPeri17 . Congratulations on your first merged Matplotlib PR 🎉 I hope we hear from you again! |
Separate font attributes && use translate(x y) in RendererSVG._draw_text_as_path
PR summary
Closes#20910
Two small changes in the SVG backend:
xlink:href
tags' position is specified viatransform=translate(x y)
rather than withx
andy
attributestext
tags separatefont
attribute into its separate constituent propertiesPR checklist