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

Skip to content

Commit 47077d1

Browse files
authored
Merge pull request #20851 from jkseppan/wqy-zenhei-install
2 parents 9cbdc75 + bf38aa9 commit 47077d1

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ commands:
5959
fonts-crosextra-carlito \
6060
fonts-freefont-otf \
6161
fonts-humor-sans \
62+
fonts-noto-cjk \
6263
optipng
6364
6465
fonts-install:

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
cm-super \
7171
dvipng \
7272
ffmpeg \
73+
fonts-noto-cjk \
7374
gdb \
7475
gir1.2-gtk-3.0 \
7576
graphviz \
@@ -106,6 +107,8 @@ jobs:
106107
;;
107108
macOS)
108109
brew install ccache
110+
brew tap homebrew/cask-fonts
111+
brew install font-noto-sans-cjk-sc
109112
;;
110113
esac
111114

azure-pipelines.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ stages:
8282
cm-super \
8383
dvipng \
8484
ffmpeg \
85+
fonts-noto-cjk \
8586
gdb \
8687
gir1.2-gtk-3.0 \
8788
graphviz \
@@ -102,6 +103,8 @@ stages:
102103
darwin)
103104
brew install --cask xquartz
104105
brew install pkg-config ffmpeg imagemagick mplayer ccache
106+
brew tap homebrew/cask-fonts
107+
brew install font-noto-sans-cjk-sc
105108
;;
106109
win32)
107110
;;

lib/matplotlib/tests/test_font_manager.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def test_utf16m_sfnt():
101101
entry = next(entry for entry in fontManager.ttflist
102102
if Path(entry.fname).name == "seguisbi.ttf")
103103
except StopIteration:
104-
pytest.skip("Couldn't find font to test against.")
104+
pytest.skip("Couldn't find seguisbi.ttf font to test against.")
105105
else:
106106
# Check that we successfully read "semibold" from the font's sfnt table
107107
# and set its weight accordingly.
@@ -111,14 +111,25 @@ def test_utf16m_sfnt():
111111
def test_find_ttc():
112112
fp = FontProperties(family=["WenQuanYi Zen Hei"])
113113
if Path(findfont(fp)).name != "wqy-zenhei.ttc":
114-
pytest.skip("Font may be missing")
115-
114+
pytest.skip("Font wqy-zenhei.ttc may be missing")
116115
fig, ax = plt.subplots()
117116
ax.text(.5, .5, "\N{KANGXI RADICAL DRAGON}", fontproperties=fp)
118117
for fmt in ["raw", "svg", "pdf", "ps"]:
119118
fig.savefig(BytesIO(), format=fmt)
120119

121120

121+
def test_find_noto():
122+
fp = FontProperties(family=["Noto Sans CJK SC", "Noto Sans CJK JP"])
123+
name = Path(findfont(fp)).name
124+
if name not in ("NotoSansCJKsc-Regular.otf", "NotoSansCJK-Regular.ttc"):
125+
pytest.skip(f"Noto Sans CJK SC font may be missing (found {name})")
126+
127+
fig, ax = plt.subplots()
128+
ax.text(0.5, 0.5, 'Hello, 你好', fontproperties=fp)
129+
for fmt in ["raw", "svg", "pdf", "ps"]:
130+
fig.savefig(BytesIO(), format=fmt)
131+
132+
122133
def test_find_invalid(tmpdir):
123134
tmp_path = Path(tmpdir)
124135

0 commit comments

Comments
 (0)