generated from shenxiangzhuang/mppt
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wordcloud): add wordcloud_chineseize (#15)
* feat(wordcloud): add wordcloud_chineseize
- Loading branch information
1 parent
22bbc7f
commit 4c7f8ab
Showing
5 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
|
||
import zhplot # noqa | ||
|
||
|
||
def test_chinese_font_config(): | ||
"""Test if wordcloud is configured to use Chinese fonts.""" | ||
font_path_env = os.getenv("FONT_PATH") | ||
assert font_path_env is not None | ||
assert "NotoSansSC-Regular" in font_path_env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
from .matplotlib import matplotlib_chineseize | ||
from .wordcloud import wordcloud_chineseize | ||
|
||
__all__ = [ | ||
"matplotlib_chineseize", | ||
"wordcloud_chineseize", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
|
||
def wordcloud_chineseize(): | ||
font_ttf: str = "NotoSansSC-Regular.ttf" | ||
os.environ["FONT_PATH"] = f"{Path(__file__).parent}/fonts/{font_ttf}" | ||
|
||
|
||
wordcloud_chineseize() |