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

Skip to content

Commit 4fe4a7c

Browse files
committed
Try with a single fontfile
1 parent 89439d2 commit 4fe4a7c

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

lib/matplotlib/tests/test_agg.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,15 @@ def test_draw_path_collection_error_handling():
259259

260260
@image_comparison(["font_fallback.png"])
261261
def test_font_fallback():
262-
fp = fm.FontProperties(family=["Noto Sans CJK SC", "Noto Sans CJK JP"])
262+
fp = fm.FontProperties(family=["Noto Sans CJK JP"])
263263
name = Path(fm.findfont(fp)).name
264-
if name not in ("NotoSansCJKsc-Regular.otf", "NotoSansCJK-Regular.ttc"):
265-
pytest.skip(f"Noto Sans CJK SC font may be missing, found: {name}")
264+
if name != "NotoSansCJK-Regular.ttc":
265+
pytest.skip(f"Noto Sans CJK JP font may be missing, found: {name}")
266266

267-
plt.rc('font', family=[
268-
'DejaVu Sans', 'Noto Sans CJK JP', 'Noto Sans CJK SC'
269-
], size=15)
270-
271-
fig, ax = plt.subplots()
272-
ax.text(0.25, 0.475, "There are 多个汉字 in between!")
267+
plt.rc('font', family=['DejaVu Sans', 'Noto Sans CJK JP'], size=15)
273268

274269
with warnings.catch_warnings():
275270
warnings.filterwarnings('ignore', 'findfont: Font family.*not found')
271+
fig, ax = plt.subplots()
272+
ax.text(0.25, 0.475, "There are 多个汉字 in between!")
276273
fig.canvas.draw()

0 commit comments

Comments
 (0)