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

Skip to content

Commit 43dbe48

Browse files
committed
fixed a bug in texmanager's font configuration, changed a warning to a
verbose report svn path=/trunk/matplotlib/; revision=3608
1 parent 637920d commit 43dbe48

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

lib/matplotlib/texmanager.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,23 +120,27 @@ def __init__(self):
120120
if ff in self.font_families:
121121
self.font_family = ff
122122
else:
123-
warnings.warn('The %s font family is not compatible with LaTeX. serif will be used by default.' % ff)
123+
mpl.verbose.report('The %s font family is not compatible with LaTeX. serif will be used by default.' % ff, 'helpful')
124124
self.font_family = 'serif'
125125

126126
fontconfig = [self.font_family]
127127
for font_family, font_family_attr in \
128128
((ff, ff.replace('-', '_')) for ff in self.font_families):
129129
for font in rcParams['font.'+font_family]:
130-
if DEBUG: print 'family: %s, font: %s, info: %s'%(font_family,
131-
font, self.font_info[font.lower()])
132130
if font.lower() in self.font_info:
131+
found_font = self.font_info[font.lower()]
133132
setattr(self, font_family_attr,
134133
self.font_info[font.lower()])
134+
if DEBUG:
135+
print 'family: %s, font: %s, info: %s'%(font_family,
136+
font, self.font_info[font.lower()])
135137
break
136138
else:
137-
warnings.warn('No LaTeX-compatible font found for the %s font family in rcParams. Using default.' % ff)
138-
setattr(self, font_family_attr, font_family)
139-
fontconfig.append(getattr(self, font_family_attr)[0])
139+
if DEBUG: print '$s font is not compatible with usetex'
140+
else:
141+
mpl.verbose.report('No LaTeX-compatible font found for the %s font family in rcParams. Using default.' % ff, 'helpful')
142+
setattr(self, font_family_attr, self.font_info[font_family])
143+
fontconfig.append(getattr(self, font_family_attr)[0])
140144
self._fontconfig = ''.join(fontconfig)
141145

142146
# The following packages and commands need to be included in the latex

0 commit comments

Comments
 (0)