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

Skip to content

Commit d6e2d81

Browse files
committed
Merge remote-tracking branch 'matplotlib/v2.x'
2 parents 0346f1a + c7d7d19 commit d6e2d81

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lib/matplotlib/font_manager.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -559,8 +559,10 @@ def createFontList(fontfiles, fontext='ttf'):
559559
for fpath in fontfiles:
560560
verbose.report('createFontDict: %s' % (fpath), 'debug')
561561
fname = os.path.split(fpath)[1]
562-
if fname in seen: continue
563-
else: seen[fname] = 1
562+
if fname in seen:
563+
continue
564+
else:
565+
seen[fname] = 1
564566
if fontext == 'afm':
565567
try:
566568
fh = open(fpath, 'rb')
@@ -573,7 +575,7 @@ def createFontList(fontfiles, fontext='ttf'):
573575
finally:
574576
fh.close()
575577
except RuntimeError:
576-
verbose.report("Could not parse font file %s"%fpath)
578+
verbose.report("Could not parse font file %s" % fpath)
577579
continue
578580
try:
579581
prop = afmFontProperty(fpath, font)
@@ -583,20 +585,21 @@ def createFontList(fontfiles, fontext='ttf'):
583585
try:
584586
font = ft2font.FT2Font(fpath)
585587
except RuntimeError:
586-
verbose.report("Could not open font file %s"%fpath)
588+
verbose.report("Could not open font file %s" % fpath)
587589
continue
588590
except UnicodeError:
589591
verbose.report("Cannot handle unicode filenames")
590-
#print >> sys.stderr, 'Bad file is', fpath
592+
# print >> sys.stderr, 'Bad file is', fpath
591593
continue
592594
try:
593595
prop = ttfFontProperty(font)
594-
except (KeyError, RuntimeError):
596+
except (KeyError, RuntimeError, ValueError):
595597
continue
596598

597599
fontlist.append(prop)
598600
return fontlist
599601

602+
600603
class FontProperties(object):
601604
"""
602605
A class for storing and manipulating font properties.

0 commit comments

Comments
 (0)