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

Skip to content

Commit 0384b85

Browse files
authored
Merge pull request #7907 from jkseppan/fc-list-format
BUG: Add a newline separator in fc-list call
2 parents 8de11e5 + d515587 commit 0384b85

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

lib/matplotlib/font_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def _call_fc_list():
281281
'This may take a moment.'))
282282
timer.start()
283283
try:
284-
out = subprocess.check_output([str('fc-list'), '--format=%{file}'])
284+
out = subprocess.check_output([str('fc-list'), '--format=%{file}\\n'])
285285
except (OSError, subprocess.CalledProcessError):
286286
return []
287287
finally:

lib/matplotlib/tests/test_font_manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@
55
import six
66

77
import os
8-
8+
import sys
99
import tempfile
1010
import warnings
1111

1212
from matplotlib.font_manager import (
1313
findfont, FontProperties, fontManager, json_dump, json_load, get_font,
14-
is_opentype_cff_font, fontManager as fm)
15-
import os.path
16-
17-
14+
get_fontconfig_fonts, is_opentype_cff_font, fontManager as fm)
1815
from matplotlib import rc_context
16+
from matplotlib.testing.decorators import skipif
1917

2018

2119
def test_font_priority():
@@ -65,3 +63,8 @@ def test_otf():
6563
with open(f, 'rb') as fd:
6664
res = fd.read(4) == b'OTTO'
6765
assert res == is_opentype_cff_font(f)
66+
67+
68+
@skipif(sys.platform == 'win32', reason='no fontconfig on Windows')
69+
def test_get_fontconfig_fonts():
70+
assert len(get_fontconfig_fonts()) > 1

0 commit comments

Comments
 (0)