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

Skip to content

Commit 7006c9c

Browse files
committed
added missing font report info to verbose handler
svn path=/trunk/matplotlib/; revision=2974
1 parent c6f9709 commit 7006c9c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CODING_GUIDE

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ in mind.
3333

3434
== Naming and spacing conventions ==
3535

36+
In general, we want to hew as closely as possible to the standard
37+
coding guidelines for python written by Guido in
38+
http://www.python.org/dev/peps/pep-0008, though we do not do this
39+
throughout.
40+
3641
functions and class methods : lower or lower_underscore_separated
3742

3843
attributes and variables : lower or lowerUpper

lib/matplotlib/font_manager.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
see license/LICENSE_TTFQUERY.
3434
"""
3535

36-
import os, sys, glob, warnings, shutil
36+
import os, sys, glob, shutil
3737
import matplotlib
3838
from matplotlib import afm
3939
from matplotlib import ft2font
@@ -445,17 +445,17 @@ def createFontDict(fontfiles, fontext='ttf'):
445445
try:
446446
font = afm.AFM(file(fpath))
447447
except RuntimeError:
448-
warnings.warn("Could not open font file %s"%fpath)
448+
verbose.report("Could not open font file %s"%fpath)
449449
continue
450450
prop = afmFontProperty(font)
451451
else:
452452
try:
453453
font = ft2font.FT2Font(str(fpath))
454454
except RuntimeError:
455-
warnings.warn("Could not open font file %s"%fpath)
455+
verbose.report("Could not open font file %s"%fpath)
456456
continue
457457
except UnicodeError:
458-
warnings.warn("Cannot handle unicode filenames")
458+
verbose.report("Cannot handle unicode filenames")
459459
#print >> sys.stderr, 'Bad file is', fpath
460460
continue
461461
try: prop = ttfFontProperty(font)
@@ -690,7 +690,7 @@ def set_name(self, names):
690690
# Remove family names from list of font names.
691691
for name in names[:]:
692692
if name.lower() in font_family:
693-
warnings.warn( msg % name)
693+
verbose.report( msg % name)
694694
while name in names:
695695
names.remove(name.lower())
696696

@@ -986,7 +986,7 @@ def findfont(self, prop, fontext='ttf'):
986986

987987
fontkey = FontKey(name, style, variant, weight, stretch, size)
988988
add_filename(fontdict, fontkey, self.defaultFont)
989-
warnings.warn('Could not match %s, %s, %s. Returning %s' % (name, style, variant, self.defaultFont))
989+
verbose.report('Could not match %s, %s, %s. Returning %s' % (name, style, variant, self.defaultFont))
990990

991991
return self.defaultFont
992992

0 commit comments

Comments
 (0)