@@ -562,8 +562,10 @@ def createFontList(fontfiles, fontext='ttf'):
562
562
for fpath in fontfiles :
563
563
verbose .report ('createFontDict: %s' % (fpath ), 'debug' )
564
564
fname = os .path .split (fpath )[1 ]
565
- if fname in seen : continue
566
- else : seen [fname ] = 1
565
+ if fname in seen :
566
+ continue
567
+ else :
568
+ seen [fname ] = 1
567
569
if fontext == 'afm' :
568
570
try :
569
571
fh = open (fpath , 'rb' )
@@ -576,7 +578,7 @@ def createFontList(fontfiles, fontext='ttf'):
576
578
finally :
577
579
fh .close ()
578
580
except RuntimeError :
579
- verbose .report ("Could not parse font file %s" % fpath )
581
+ verbose .report ("Could not parse font file %s" % fpath )
580
582
continue
581
583
try :
582
584
prop = afmFontProperty (fpath , font )
@@ -586,20 +588,21 @@ def createFontList(fontfiles, fontext='ttf'):
586
588
try :
587
589
font = ft2font .FT2Font (fpath )
588
590
except RuntimeError :
589
- verbose .report ("Could not open font file %s" % fpath )
591
+ verbose .report ("Could not open font file %s" % fpath )
590
592
continue
591
593
except UnicodeError :
592
594
verbose .report ("Cannot handle unicode filenames" )
593
- #print >> sys.stderr, 'Bad file is', fpath
595
+ # print >> sys.stderr, 'Bad file is', fpath
594
596
continue
595
597
try :
596
598
prop = ttfFontProperty (font )
597
- except (KeyError , RuntimeError ):
599
+ except (KeyError , RuntimeError , ValueError ):
598
600
continue
599
601
600
602
fontlist .append (prop )
601
603
return fontlist
602
604
605
+
603
606
class FontProperties (object ):
604
607
"""
605
608
A class for storing and manipulating font properties.
0 commit comments