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

Skip to content

Commit 70e7820

Browse files
authored
Merge pull request #12336 from meeseeksmachine/auto-backport-of-pr-12212-on-v3.0.x
Backport PR #12212 on branch v3.0.x (font_manager: Fixed problems with Path(...).suffix)
2 parents 3d9d656 + a0e8fcc commit 70e7820

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/font_manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def list_fonts(directory, extensions):
154154
extensions = ["." + ext for ext in extensions]
155155
return [str(path)
156156
for path in filter(Path.is_file, Path(directory).glob("**/*.*"))
157-
if path.suffix in extensions]
157+
if path.suffix.lower() in extensions]
158158

159159

160160
def win32FontDirectory():
@@ -186,7 +186,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
186186
if directory is None:
187187
directory = win32FontDirectory()
188188

189-
fontext = get_fontext_synonyms(fontext)
189+
fontext = ['.' + ext for ext in get_fontext_synonyms(fontext)]
190190

191191
items = set()
192192
for fontdir in MSFontDirectories:
@@ -238,9 +238,9 @@ def _call_fc_list():
238238
def get_fontconfig_fonts(fontext='ttf'):
239239
"""List the font filenames known to `fc-list` having the given extension.
240240
"""
241-
fontext = get_fontext_synonyms(fontext)
241+
fontext = ['.' + ext for ext in get_fontext_synonyms(fontext)]
242242
return [fname for fname in _call_fc_list()
243-
if Path(fname).suffix[1:] in fontext]
243+
if Path(fname).suffix.lower() in fontext]
244244

245245

246246
def findSystemFonts(fontpaths=None, fontext='ttf'):

0 commit comments

Comments
 (0)