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

Skip to content

Commit e877223

Browse files
committed
Fix for when no afm files are installed. From https://bugzilla.redhat.com/show_bug.cgi?id=896182, though fixed in a different way.
1 parent f2a2f26 commit e877223

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/font_manager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,10 @@ def __init__(self, size=None, weight='normal'):
997997
self.afmfiles = findSystemFonts(paths, fontext='afm') + \
998998
findSystemFonts(fontext='afm')
999999
self.afmlist = createFontList(self.afmfiles, fontext='afm')
1000-
self.defaultFont['afm'] = self.afmfiles[0]
1000+
if len(self.afmfiles):
1001+
self.defaultFont['afm'] = self.afmfiles[0]
1002+
else:
1003+
self.defaultFont['afm'] = None
10011004

10021005
self.ttf_lookup_cache = {}
10031006
self.afm_lookup_cache = {}

0 commit comments

Comments
 (0)