BloodGlucoseManagement / font_setup.py
DeepWeek's picture
Upload 9 files
714c84b verified
raw
history blame contribute delete
581 Bytes
import os
import matplotlib.pyplot as plt
import matplotlib.font_manager as fm
# Install Japanese fonts
os.system("apt-get update && apt-get install -y fonts-noto-cjk")
# Set font path and apply
font_path = "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"
if os.path.exists(font_path):
font_prop = fm.FontProperties(fname=font_path)
plt.rcParams["font.family"] = font_prop.get_name()
print(f"βœ… Japanese font applied: {font_prop.get_name()}")
else:
print("❌ Japanese font not found")
font_properties = font_prop if os.path.exists(font_path) else None