Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change CJK fonts to SourceHanSerif #337

Merged
merged 5 commits into from
Jan 7, 2025
Merged

Conversation

timelic
Copy link
Contributor

@timelic timelic commented Dec 25, 2024

添加更改中日韩字体为思源宋体的选项,以统一 Windows、Linux 和 Mac 系统上的阅读体验。

#271

需要在gradio上的帮助,因为我不太熟悉gradio。

@timelic timelic marked this pull request as draft December 25, 2024 04:09
@awwaawwa
Copy link
Contributor

I see you wrote ttf_path = os.environ.get("SHS_FONT_PATH", "/app/SourceHanSerif-Medium.ttc") in the code, but you didn't make the corresponding changes to the Dockerfile. Can you add an ADD instruction like Dockerfile#L9C1-L10C1 to download the font into the Docker image?

@timelic
Copy link
Contributor Author

timelic commented Dec 25, 2024

@awwaawwa Yes, I have added the font to the Dockerfile.

@timelic
Copy link
Contributor Author

timelic commented Dec 25, 2024

@awwaawwa 问题在于我们需要在docker里面下载字体吗?包括Noto,似乎都不是必须下载的。按需加载就好?

@awwaawwa
Copy link
Contributor

由于奇奇怪怪的网络原因,部署docker的机器不一定能顺利下载到字体

@timelic
Copy link
Contributor Author

timelic commented Dec 25, 2024

由于奇奇怪怪的网络原因,部署docker的机器不一定能顺利下载到字体

原来如此,那确实需要考虑这方面。

@timelic
Copy link
Contributor Author

timelic commented Dec 25, 2024

@hellofinch 请求在gradio前端方面得到帮助🙏 我尝试了但是感觉效果不好

@hellofinch
Copy link
Contributor

@timelic 我尽力而为。🙏

@timelic
Copy link
Contributor Author

timelic commented Dec 26, 2024

@timelic 我尽力而为。🙏

非常感谢!

@timelic timelic force-pushed the dev/SourceHanSerif branch 2 times, most recently from 0954cc5 to 6dd6656 Compare January 6, 2025 02:59
@timelic timelic force-pushed the dev/SourceHanSerif branch from 63a41c9 to 7ed13c2 Compare January 6, 2025 06:49
@timelic timelic marked this pull request as ready for review January 6, 2025 07:38
@timelic
Copy link
Contributor Author

timelic commented Jan 6, 2025

@Byaidu 应该能合并了。

  • 不再使用pymupdf提供的内置字体(在不同平台效果不一致),转为使用统一的字体。
  • 统一了外置字体逻辑。本地测试显示效果无问题,字体子集化无问题,不会产生过大的PDF文件。

@timelic timelic changed the title add option to change CJK fonts to SourceHanSerif change CJK fonts to SourceHanSerif Jan 6, 2025
@Byaidu Byaidu merged commit d22bbc6 into Byaidu:main Jan 7, 2025
2 checks passed
hellofinch pushed a commit to hellofinch/PDFMathTranslate that referenced this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants