@@ -559,8 +559,10 @@ def createFontList(fontfiles, fontext='ttf'):
559
559
for fpath in fontfiles :
560
560
verbose .report ('createFontDict: %s' % (fpath ), 'debug' )
561
561
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
564
566
if fontext == 'afm' :
565
567
try :
566
568
fh = open (fpath , 'rb' )
@@ -573,7 +575,7 @@ def createFontList(fontfiles, fontext='ttf'):
573
575
finally :
574
576
fh .close ()
575
577
except RuntimeError :
576
- verbose .report ("Could not parse font file %s" % fpath )
578
+ verbose .report ("Could not parse font file %s" % fpath )
577
579
continue
578
580
try :
579
581
prop = afmFontProperty (fpath , font )
@@ -583,20 +585,21 @@ def createFontList(fontfiles, fontext='ttf'):
583
585
try :
584
586
font = ft2font .FT2Font (fpath )
585
587
except RuntimeError :
586
- verbose .report ("Could not open font file %s" % fpath )
588
+ verbose .report ("Could not open font file %s" % fpath )
587
589
continue
588
590
except UnicodeError :
589
591
verbose .report ("Cannot handle unicode filenames" )
590
- #print >> sys.stderr, 'Bad file is', fpath
592
+ # print >> sys.stderr, 'Bad file is', fpath
591
593
continue
592
594
try :
593
595
prop = ttfFontProperty (font )
594
- except (KeyError , RuntimeError ):
596
+ except (KeyError , RuntimeError , ValueError ):
595
597
continue
596
598
597
599
fontlist .append (prop )
598
600
return fontlist
599
601
602
+
600
603
class FontProperties (object ):
601
604
"""
602
605
A class for storing and manipulating font properties.
0 commit comments