Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbf38aa9

Browse files
committed
Try to install the Noto Sans CJK font
On Linux and Mac. Add a font_manager test that loads the font anduses it. This could be useful in testing the multi-font support(#20740 etc).I couldn't get the font installed on Windows. There is a Chocolateyinstaller that installs all of the Noto fonts, which takes a reallylong time to run.
1 parenta4e81e7 commitbf38aa9

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
@@ -65,6 +65,7 @@ jobs:
6565
cm-super \
6666
dvipng \
6767
ffmpeg \
68+
fonts-noto-cjk \
6869
gdb \
6970
gir1.2-gtk-3.0 \
7071
graphviz \
@@ -101,6 +102,8 @@ jobs:
101102
;;
102103
macOS)
103104
brew install ccache
105+
brew tap homebrew/cask-fonts
106+
brew install font-noto-sans-cjk-sc
104107
;;
105108
esac
106109

‎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(entryforentryinfontManager.ttflist
102102
ifPath(entry.fname).name=="seguisbi.ttf")
103103
exceptStopIteration:
104-
pytest.skip("Couldn't find font to test against.")
104+
pytest.skip("Couldn't findseguisbi.ttffont 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
deftest_find_ttc():
112112
fp=FontProperties(family=["WenQuanYi Zen Hei"])
113113
ifPath(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
forfmtin ["raw","svg","pdf","ps"]:
119118
fig.savefig(BytesIO(),format=fmt)
120119

121120

121+
deftest_find_noto():
122+
fp=FontProperties(family=["Noto Sans CJK SC","Noto Sans CJK JP"])
123+
name=Path(findfont(fp)).name
124+
ifnamenotin ("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+
forfmtin ["raw","svg","pdf","ps"]:
130+
fig.savefig(BytesIO(),format=fmt)
131+
132+
122133
deftest_find_invalid(tmpdir):
123134
tmp_path=Path(tmpdir)
124135

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp