Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 333dad1

Browse filesBrowse files
committed
font_manager: Fixed problems with Path(...).suffix
The problem is that `Path(...).suffix` includes the dot, so ``.ttf` in 'ttf'` gives `False`. Also fixed other suffix usages.
1 parent 6b4048d commit 333dad1
Copy full SHA for 333dad1

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+4-4Lines 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():
@@ -187,7 +187,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'):
187187
if directory is None:
188188
directory = win32FontDirectory()
189189

190-
fontext = get_fontext_synonyms(fontext)
190+
fontext = ['.' + ext for ext in get_fontext_synonyms(fontext)]
191191

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

247247

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.