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

Skip to content

Don't use deprecated get_texcommand in backend_pgf. #11192

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions lib/matplotlib/backends/backend_pgf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import math
import os
from pathlib import Path
import pathlib
import re
import shutil
import subprocess
Expand Down Expand Up @@ -69,7 +69,7 @@ def get_fontspec():
for family, command in zip(families, commands):
# 1) Forward slashes also work on Windows, so don't mess with
# backslashes. 2) The dirname needs to include a separator.
path = Path(fm.findfont(family))
path = pathlib.Path(fm.findfont(family))
latex_fontspec.append(r"\%s{%s}[Path=%s]" % (
command, path.name, path.parent.as_posix() + "/"))

Expand Down Expand Up @@ -1118,9 +1118,9 @@ def close(self):
open(self._outputfile, 'wb').close()

def _run_latex(self):
texcommand = get_texcommand()
texcommand = rcParams["pgf.texsystem"]
cmdargs = [
str(texcommand),
texcommand,
"-interaction=nonstopmode",
"-halt-on-error",
os.path.basename(self._fname_tex),
Expand Down Expand Up @@ -1182,12 +1182,11 @@ def _build_newpage_command(self, width, height):
so we need to check the lualatex version and use `\pagewidth` if
the version is 0.85 or newer
'''
texcommand = get_texcommand()
texcommand = rcParams["pgf.texsystem"]
if texcommand == 'lualatex' and _get_lualatex_version() >= (0, 85, 0):
cmd = r'\page'
else:
cmd = r'\pdfpage'

newpage = r'\newpage{cmd}width={w}in,{cmd}height={h}in%' + '\n'
return newpage.format(cmd=cmd, w=width, h=height).encode('utf-8')

Expand Down