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

Skip to content

Commit 9b8d6f1

Browse files
committed
Deprecate backend_pgf.get_texcommand.
The rcparam system already handles validation.
1 parent 1a8b352 commit 9b8d6f1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import weakref
1717

1818
import matplotlib as mpl
19-
from matplotlib import _png, font_manager as fm, rcParams
19+
from matplotlib import _png, cbook, font_manager as fm, rcParams
2020
from matplotlib.backend_bases import (
2121
_Backend, FigureCanvasBase, FigureManagerBase, GraphicsContextBase,
2222
RendererBase)
@@ -30,6 +30,7 @@
3030
###############################################################################
3131

3232

33+
@cbook.deprecated
3334
def get_texcommand():
3435
"""Get chosen TeX system from rc."""
3536
texsystem_options = ["xelatex", "lualatex", "pdflatex"]
@@ -40,7 +41,7 @@ def get_texcommand():
4041
def get_fontspec():
4142
"""Build fontspec preamble from rc."""
4243
latex_fontspec = []
43-
texcommand = get_texcommand()
44+
texcommand = rcParams["pgf.texsystem"]
4445

4546
if texcommand != "pdflatex":
4647
latex_fontspec.append("\\usepackage{fontspec}")
@@ -126,7 +127,7 @@ def _font_properties_str(prop):
126127
family = prop.get_family()[0]
127128
if family in families:
128129
commands.append(families[family])
129-
elif family in system_fonts and get_texcommand() != "pdflatex":
130+
elif family in system_fonts and rcParams["pgf.texsystem"] != "pdflatex":
130131
commands.append(r"\setmainfont{%s}\rmfamily" % family)
131132
else:
132133
pass # print warning?
@@ -195,7 +196,7 @@ class LatexManagerFactory(object):
195196

196197
@staticmethod
197198
def get_latex_manager():
198-
texcommand = get_texcommand()
199+
texcommand = rcParams["pgf.texsystem"]
199200
latex_header = LatexManager._build_latex_header()
200201
prev = LatexManagerFactory.previous_instance
201202

@@ -273,7 +274,7 @@ def __init__(self):
273274
LatexManager._unclean_instances.add(self)
274275

275276
# test the LaTeX setup to ensure a clean startup of the subprocess
276-
self.texcommand = get_texcommand()
277+
self.texcommand = rcParams["pgf.texsystem"]
277278
self.latex_header = LatexManager._build_latex_header()
278279
latex_end = "\n\\makeatletter\n\\@@end\n"
279280
try:
@@ -877,7 +878,7 @@ def _print_pdf_to_fh(self, fh, *args, **kwargs):
877878
with codecs.open(fname_tex, "w", "utf-8") as fh_tex:
878879
fh_tex.write(latexcode)
879880

880-
texcommand = get_texcommand()
881+
texcommand = rcParams["pgf.texsystem"]
881882
cmdargs = [str(texcommand), "-interaction=nonstopmode",
882883
"-halt-on-error", "figure.tex"]
883884
try:

0 commit comments

Comments
 (0)