8000 Disable use of FreeType in dvipng for test reproducibility. · matplotlib/matplotlib@0cdd0e8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0cdd0e8

Browse files
committed
Disable use of FreeType in dvipng for test reproducibility.
Unfortunately at least some dvipngs appear to be statically linked to FreeType so we can't play tricks with LD_PRELOAD/LD_LIBRARY_PATH.
1 parent 285e987 commit 0cdd0e8

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/matplotlib/texmanager.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,16 @@ def make_png(self, tex, fontsize, dpi):
350350
# see get_rgba for a discussion of the background
351351
if not os.path.exists(pngfile):
352352
dvifile = self.make_dvi(tex, fontsize)
353-
self._run_checked_subprocess(
354-
["dvipng", "-bg", "Transparent", "-D", str(dpi),
355-
"-T", "tight", "-o", pngfile, dvifile], tex)
353+
cmd = ["dvipng", "-bg", "Transparent", "-D", str(dpi),
354+
"-T", "tight", "-o", pngfile, dvifile]
355+
# When testing, disable FreeType rendering for reproducibility; but
356+
# dvipng 1.16 has a bug (fixed in f3ff241) that breaks --freetype0
357+
# mode, so for it we keep FreeType enabled; the image will be
358+
# slightly off.
359+
if (getattr(mpl, "_called_from_pytest", False)
360+
and mpl._get_executable_info("dvipng").version != "1.16"):
361+
cmd.insert(1, "--freetype0")
362+
self._run_checked_subprocess(cmd, tex)
356363
return pngfile
357364

358365
def get_grey(self, tex, fontsize=None, dpi=None):

0 commit comments

Comments
 (0)
0