Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1652ed1

Browse files
authored
Merge pull request #11192 from anntzer/pgffix2
Don't use deprecated get_texcommand in backend_pgf.
2 parents f817aff + b3b8841 commit 1652ed1

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import logging
55
import math
66
import os
7-
from pathlib import Path
7+
import pathlib
88
import re
99
import shutil
1010
import subprocess
@@ -69,7 +69,7 @@ def get_fontspec():
6969
for family, command in zip(families, commands):
7070
# 1) Forward slashes also work on Windows, so don't mess with
7171
# backslashes. 2) The dirname needs to include a separator.
72-
path = Path(fm.findfont(family))
72+
path = pathlib.Path(fm.findfont(family))
7373
latex_fontspec.append(r"\%s{%s}[Path=%s]" % (
7474
command, path.name, path.parent.as_posix() + "/"))
7575

@@ -1119,9 +1119,9 @@ def close(self):
11191119
open(self._outputfile, 'wb').close()
11201120

11211121
def _run_latex(self):
1122-
texcommand = get_texcommand()
1122+
texcommand = rcParams["pgf.texsystem"]
11231123
cmdargs = [
1124-
str(texcommand),
1124+
texcommand,
11251125
"-interaction=nonstopmode",
11261126
"-halt-on-error",
11271127
os.path.basename(self._fname_tex),
@@ -1183,12 +1183,11 @@ def _build_newpage_command(self, width, height):
11831183
so we need to check the lualatex version and use `\pagewidth` if
11841184
the version is 0.85 or newer
11851185
'''
1186-
texcommand = get_texcommand()
1186+
texcommand = rcParams["pgf.texsystem"]
11871187
if texcommand == 'lualatex' and _get_lualatex_version() >= (0, 85, 0):
11881188
cmd = r'\page'
11891189
else:
11901190
cmd = r'\pdfpage'
1191-
11921191
newpage = r'\newpage{cmd}width={w}in,{cmd}height={h}in%' + '\n'
11931192
return newpage.format(cmd=cmd, w=width, h=height).encode('utf-8')
11941193

0 commit comments

Comments
 (0)