Spaces:
Sleeping
Sleeping
Upload plot_fonts.py
Browse files- utils/plot_fonts.py +12 -0
utils/plot_fonts.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# utils/plot_fonts.py
|
| 2 |
+
import os
|
| 3 |
+
from matplotlib import font_manager, rcParams
|
| 4 |
+
|
| 5 |
+
def setup_korean_font(project_root, ttf_name="NanumGothic.ttf"):
|
| 6 |
+
font_path = os.path.join(project_root, ttf_name)
|
| 7 |
+
if os.path.exists(font_path):
|
| 8 |
+
font_manager.fontManager.addfont(font_path)
|
| 9 |
+
rcParams["font.family"] = font_manager.FontProperties(fname=font_path).get_name()
|
| 10 |
+
else:
|
| 11 |
+
rcParams["font.family"] = ["NanumGothic", "AppleGothic", "Malgun Gothic", "DejaVu Sans"]
|
| 12 |
+
rcParams["axes.unicode_minus"] = False
|