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

Skip to content

Commit b878d2b

Browse files
aitikguptatacaswell
authored andcommitted
Allow multiple Noto font types
1 parent 3ed8df4 commit b878d2b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

lib/matplotlib/tests/test_agg.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import io
22
import pathlib
3+
import warnings
34

45
import numpy as np
56
from numpy.testing import assert_array_almost_equal
@@ -355,12 +356,18 @@ def test_chunksize_toobig_chunks(chunk_limit_setup):
355356

356357
@image_comparison(["font_fallback.png"])
357358
def test_font_fallback():
358-
fp = fm.FontProperties(family=["Noto Sans CJK JP"])
359+
fp = fm.FontProperties(family=["Noto Sans CJK SC", "Noto Sans CJK JP"])
359360
name = pathlib.Path(fm.findfont(fp)).name
360361
if name not in ("NotoSansCJKsc-Regular.otf", "NotoSansCJK-Regular.ttc"):
361-
pytest.skip(f"Noto Sans CJK JP font may be missing, found: {name}")
362+
pytest.skip(f"Noto Sans CJK SC font may be missing, found: {name}")
362363

363-
plt.rc('font', family=['DejaVu Sans', 'Noto Sans CJK JP'], size=15)
364+
plt.rc('font', family=[
365+
'DejaVu Sans', 'Noto Sans CJK JP', 'Noto Sans CJK SC'
366+
], size=15)
364367

365368
fig, ax = plt.subplots()
366369
ax.text(0.25, 0.475, "There are 多个汉字 in between!")
370+
371+
with warnings.catch_warnings():
372+
warnings.filterwarnings('ignore', 'findfont: Font family.*not found')
373+
fig.canvas.draw()

0 commit comments

Comments
 (0)