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

Skip to content

Commit 444383e

Browse files
committed
Better group logging of font handling by texmanager.
Print all unusable font names together after a usable font has been found, rather than one at a time. This makes the log easier to read.
1 parent 46b39ab commit 444383e

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/matplotlib/texmanager.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,16 @@ def _get_font_preamble_and_command(cls):
134134
preambles[font_family] = cls._font_preambles[
135135
mpl.rcParams['font.family'][0].lower()]
136136
else:
137-
for font in mpl.rcParams['font.' + font_family]:
138-
if font.lower() in cls._font_preambles:
139-
preambles[font_family] = \
140-
cls._font_preambles[font.lower()]
137+
rcfonts = mpl.rcParams[f"font.{font_family}"]
138+
for i, font in enumerate(map(str.lower, rcfonts)):
139+
if font in cls._font_preambles:
140+
preambles[font_family] = cls._font_preambles[font]
141141
_log.debug(
142-
'family: %s, font: %s, info: %s',
143-
font_family, font,
144-
cls._font_preambles[font.lower()])
142+
'family: %s, package: %s, font: %s, skipped: %s',
143+
font_family, cls._font_preambles[font], rcfonts[i],
144+
', '.join(rcfonts[:i]),
145+
)
145146
break
146-
else:
147-
_log.debug('%s font is not compatible with usetex.',
148-
font)
149147
else:
150148
_log.info('No LaTeX-compatible font found for the %s font'
151149
'family in rcParams. Using default.',

0 commit comments

Comments
 (0)