Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit154fba8

Browse files
committed
TST: Re-generate SVG files that use fonttype='none'
We currently special-case the SVG converter depending on if it usedfonttype='none', and use one that has our base fonts available. However,this is not based on the rcParam setting (because we don't have that atconversion time), but on whether the SVG text contains the font styling[1]. This check for styling uses the _current_ version, which waschanged way back in#19253.These files were never re-generated though, and used the old version ofthe style, meaning the expected images never triggered the specialconverter. The result images are written with the current style, and_do_ trigger the special conveter.Evidentally, this never was a problem for most developers, becauseeveryone had DejaVu Sans installed globally, so the expected imagesmatched. However, on the clean macOS CI, it's not installed globally, sothe expected images get converted with the wrong font, and the testfails.[1]https://github.com/matplotlib/matplotlib/blob/de1102668dbc0694e98653bd17641e9d99394e57/lib/matplotlib/testing/compare.py#L303
1 parentad40092 commit154fba8

File tree

4 files changed

+125
-95
lines changed

4 files changed

+125
-95
lines changed

‎lib/matplotlib/backends/backend_svg.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,10 @@ def _draw_text_as_path(self, gc, x, y, s, prop, angle, ismath, mtext=None):
10851085
writer.end('g')
10861086

10871087
def_draw_text_as_text(self,gc,x,y,s,prop,angle,ismath,mtext=None):
1088+
# NOTE: If you change the styling, then be sure the chack in
1089+
# `lib/matplotlib/testing/compare.py::convert` remains in sync. Also be sure to
1090+
# re-generate any SVG using this mode, or else such tests will fail to use the
1091+
# right converter for the expected images, and they will fail strangely.
10881092
writer=self.writer
10891093

10901094
color=rgb2hex(gc.get_rgb())

‎lib/matplotlib/testing/compare.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,10 @@ def convert(filename, cache):
300300
convert=converter[path.suffix[1:]]
301301
ifpath.suffix==".svg":
302302
contents=path.read_text()
303+
# NOTE: This check should be kept in sync with font styling in
304+
# `lib/matplotlib/backends/backend_svg.py`. If it changes, then be sure to
305+
# re-generate any SVG using this mode, or else such tests will fail to use
306+
# the converter for the expected images, and they will fail strangely.
303307
if'style="font:'incontents:
304308
# for svg.fonttype = none, we explicitly patch the font search
305309
# path so that fonts shipped by Matplotlib are found.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp