8000 PGF: Only force loading fontspec if pgf.rcfonts=True · matplotlib/matplotlib@a3eaef6 · GitHub
[go: up one dir, main page]

Skip to content

Commit a3eaef6

Browse files
committed
PGF: Only force loading fontspec if pgf.rcfonts=True
1 parent e42c204 commit a3eaef6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ def _get_preamble():
4444
r"\everymath=\expandafter{\the\everymath\displaystyle}",
4545
# Allow pgf.preamble to override the above definitions.
4646
mpl.rcParams["pgf.preamble"],
47-
r"\ifdefined\pdftexversion\else % non-pdftex case.",
48-
r" \usepackage{fontspec}",
4947
*([
48+
r"\ifdefined\pdftexversion\else % non-pdftex case.",
49+
r" \usepackage{fontspec}",
50+
] + [
5051
r" \%s{%s}[Path=\detokenize{%s/}]"
5152
% (command, path.name, path.parent.as_posix())
5253
for command, path in zip(
5354
["setmainfont", "setsansfont", "setmonofont"],
5455
[pathlib.Path(fm.findfont(family))
5556
for family in ["serif", "sans\\-serif", "monospace"]]
5657
)
57-
] if mpl.rcParams["pgf.rcfonts"] else []),
58-
r"\fi",
58+
] + [r"\fi"] if mpl.rcParams["pgf.rcfonts"] else []),
5959
# Documented as "must come last".
6060
mpl.texmanager._usepackage_if_not_loaded("underscore", option="strings"),
6161
])

0 commit comments

Comments
 (0)
0