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

Skip to content

Commit 2415c62

Browse files
committed
Fixes #1879: Properly decode filenames that we get from fc-match
1 parent 2920408 commit 2415c62

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/font_manager.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,11 +1289,12 @@ def fc_match(pattern, fontext):
12891289
if pipe.returncode == 0:
12901290
for match in _fc_match_regex.finditer(output):
12911291
file = match.group(1)
1292+
file = file.decode(sys.getfilesystemencoding())
12921293
if os.path.splitext(file)[1][1:] in fontexts:
12931294
return file
12941295
return None
12951296

1296-
_fc_match_regex = re.compile(r'\sfile:\s+"([^"]*)"')
1297+
_fc_match_regex = re.compile(rb'\sfile:\s+"([^"]*)"')
12971298
_fc_match_cache = {}
12981299

12991300
def findfont(prop, fontext='ttf'):

0 commit comments

Comments
 (0)