diff --git a/resources/fonts/genshin.ttf b/resources/fonts/genshin.ttf deleted file mode 100644 index 1ea570001..000000000 Binary files a/resources/fonts/genshin.ttf and /dev/null differ diff --git a/resources/fonts/syst.otf b/resources/fonts/syst.otf new file mode 100644 index 000000000..91b48b7fc Binary files /dev/null and b/resources/fonts/syst.otf differ diff --git a/util/general_utils.py b/util/general_utils.py index 279886a83..9af094a2e 100644 --- a/util/general_utils.py +++ b/util/general_utils.py @@ -95,10 +95,10 @@ def port_checker(port: int, host: str = "localhost"): return False def word2img(title: str, text: str, max_width=30, font_size=20): - if os.path.exists("resources/fonts/genshin.ttf"): - font_path = "resources/fonts/genshin.ttf" - elif os.path.exists("QQChannelChatGPT/resources/fonts/genshin.ttf"): - font_path = "QQChannelChatGPT/resources/fonts/genshin.ttf" + if os.path.exists("resources/fonts/syst.otf"): + font_path = "resources/fonts/syst.otf" + elif os.path.exists("QQChannelChatGPT/resources/fonts/syst.otf"): + font_path = "QQChannelChatGPT/resources/fonts/syst.otf" elif os.path.exists("C:/Windows/Fonts/simhei.ttf"): font_path = "C:/Windows/Fonts/simhei.ttf" elif os.path.exists("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"): @@ -140,29 +140,12 @@ def word2img(title: str, text: str, max_width=30, font_size=20): return image -def word2img_markdown(markdown: str, max_width=35, font_size=25): - - if os.path.exists("resources/fonts/genshin.ttf"): - font_path = "resources/fonts/genshin.ttf" - elif os.path.exists("QQChannelChatGPT/resources/fonts/genshin.ttf"): - font_path = "QQChannelChatGPT/resources/fonts/genshin.ttf" - elif os.path.exists("C:/Windows/Fonts/simhei.ttf"): - font_path = "C:/Windows/Fonts/simhei.ttf" - elif os.path.exists("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"): - font_path = "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc" - else: - raise Exception("找不到字体文件") - - # try to render markdown - - - def render_markdown(markdown_text, image_width=800, image_height=600, font_size=16, font_color=(0, 0, 0), bg_color=(255, 255, 255)): - if os.path.exists("resources/fonts/genshin.ttf"): - font_path = "resources/fonts/genshin.ttf" - elif os.path.exists("QQChannelChatGPT/resources/fonts/genshin.ttf"): - font_path = "QQChannelChatGPT/resources/fonts/genshin.ttf" + if os.path.exists("resources/fonts/syst.otf"): + font_path = "resources/fonts/syst.otf" + elif os.path.exists("QQChannelChatGPT/resources/fonts/syst.otf"): + font_path = "QQChannelChatGPT/resources/fonts/syst.otf" elif os.path.exists("C:/Windows/Fonts/simhei.ttf"): font_path = "C:/Windows/Fonts/simhei.ttf" elif os.path.exists("/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"):