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

Skip to content

Commit 2f80fb8

Browse files
Fix #20850
Do not remove serif font family in pgf example to avoid Warning Add requested changes Revert "Fix #20850" This reverts commit 0bff071.
1 parent 1d12973 commit 2f80fb8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/matplotlib/backends/backend_pgf.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ def get_fontspec():
5050
for family, command in zip(families, commands):
5151
# 1) Forward slashes also work on Windows, so don't mess with
5252
# backslashes. 2) The dirname needs to include a separator.
53-
path = pathlib.Path(fm.findfont(family))
54-
latex_fontspec.append(r"\%s{%s}[Path=\detokenize{%s}]" % (
55-
command, path.name, path.parent.as_posix() + "/"))
53+
try:
54+
path = pathlib.Path(
55+
fm.findfont(family, fallback_to_default=False))
56+
except ValueError:
57+
pass
58+
else:
59+
latex_fontspec.append(r"\%s{%s}[Path=\detokenize{%s}]" % (
60+
command, path.name, path.parent.as_posix() + "/"))
5661

5762
return "\n".join(latex_fontspec)
5863

0 commit comments

Comments
 (0)