Skip to content

Commit af9e511

Browse files
committed
Fix font deduplication logic in createFontList.
Only add a font name to the "seen" list if one successfully extracts the font properties from it; otherwise a first font that cannot be read (e.g. due to permission issues) will mask a later font that can.
1 parent f2e0479 commit af9e511

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,8 +517,6 @@ def createFontList(fontfiles, fontext='ttf'):
517517
fname = os.path.split(fpath)[1]
518518
if fname in seen:
519519
continue
520-
else:
521-
seen.add(fname)
522520
if fontext == 'afm':
523521
try:
524522
with open(fpath, 'rb') as fh:
@@ -551,6 +549,7 @@ def createFontList(fontfiles, fontext='ttf'):
551549
continue
552550

553551
fontlist.append(prop)
552+
seen.add(fname)
554553
return fontlist
555554

556555

0 commit comments

Comments
 (0)