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

Skip to content

Commit a0313ec

Browse files
committed
Deprecate backend_pgf.get_texcommand.
The rcparam system already handles validation.
1 parent 76ecd02 commit a0313ec

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
@@ -17,7 +17,7 @@
1717
import weakref
1818

1919
import matplotlib as mpl
20-
from matplotlib import _png, font_manager as fm, rcParams
20+
from matplotlib import _png, cbook, font_manager as fm, rcParams
2121
from matplotlib.backend_bases import (
2222
_Backend, FigureCanvasBase, FigureManagerBase, GraphicsContextBase,
2323
RendererBase)
@@ -29,6 +29,7 @@
2929
###############################################################################
3030

3131

32+
@cbook.deprecated
3233
def get_texcommand():
3334
"""Get chosen TeX system from rc."""
3435
texsystem_options = ["xelatex", "lualatex", "pdflatex"]
@@ -39,7 +40,7 @@ def get_texcommand():
3940
def get_fontspec():
4041
"""Build fontspec preamble from rc."""
4142
latex_fontspec = []
42-
texcommand = get_texcommand()
43+
texcommand = rcParams["pgf.texsystem"]
4344

4445
if texcommand != "pdflatex":
4546
latex_fontspec.append("\\usepackage{fontspec}")
@@ -125,7 +126,7 @@ def _font_properties_str(prop):
125126
family = prop.get_family()[0]
126127
if family in families:
127128
commands.append(families[family])
128-
elif family in system_fonts and get_texcommand() != "pdflatex":
129+
elif family in system_fonts and rcParams["pgf.texsystem"] != "pdflatex":
129130
commands.append(r"\setmainfont{%s}\rmfamily" % family)
130131
else:
131132
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)