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

Skip to content

Commit b3b8841

Browse files
committed
Don't use deprecated get_texcommand in backend_pgf.
1 parent fb98a9a commit b3b8841

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

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

11201120
def _run_latex(self):
1121-
texcommand = get_texcommand()
1121+
texcommand = rcParams["pgf.texsystem"]
11221122
cmdargs = [
1123-
str(texcommand),
1123+
texcommand,
11241124
"-interaction=nonstopmode",
11251125
"-halt-on-error",
11261126
os.path.basename(self._fname_tex),
@@ -1182,12 +1182,11 @@ def _build_newpage_command(self, width, height):
11821182
so we need to check the lualatex version and use `\pagewidth` if
11831183
the version is 0.85 or newer
11841184
'''
1185-
texcommand = get_texcommand()
1185+
texcommand = rcParams["pgf.texsystem"]
11861186
if texcommand == 'lualatex' and _get_lualatex_version() >= (0, 85, 0):
11871187
cmd = r'\page'
11881188
else:
11891189
cmd = r'\pdfpage'
1190-
11911190
newpage = r'\newpage{cmd}width={w}in,{cmd}height={h}in%' + '\n'
11921191
return newpage.format(cmd=cmd, w=width, h=height).encode('utf-8')
11931192

0 commit comments

Comments
 (0)