Skip to content

Commit 2dd780d

Browse files
committed
Normalize path case before checking for fonts.
This is a problem on Windows where file paths are case-insensitive.
1 parent 5f8f0be commit 2dd780d

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
@@ -1284,13 +1284,16 @@ def findfont(self, prop, fontext='ttf', directory=None,
12841284
cached = _lookup_cache[fontext].get(prop)
12851285
if cached is not None:
12861286
return cached
1287+
else:
1288+
directory = os.path.normcase(directory)
12871289

12881290
best_score = 1e64
12891291
best_font = None
12901292

12911293
for font in fontlist:
12921294
if (directory is not None and
1293-
os.path.commonprefix([font.fname, directory]) != directory):
1295+
os.path.commonprefix([os.path.normcase(font.fname),
1296+
directory]) != directory):
12941297
continue
12951298
# Matching family should have highest priority, so it is multiplied
12961299
# by 10.0

0 commit comments

Comments
 (0)