mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-23 10:02:10 -05:00
enh: Better CJK language support when downloading pdf #1721
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @y0umu on GitHub (Aug 8, 2024).
Is your feature request related to a problem? Please describe.
When I try to download the conversation as pdf, Chinese (traditional or simplified) charactors are missing glyphs. Examples below
Got
WARNI [fpdf.output] Font MPDFAA+NotoSans is missing the following glyphs: 啟, 鸠when downloading the pdf.Got
WARNI [fpdf.output] Font MPDFAA+NotoSans is missing the following glyphs: 谁, 这, 话, 时, 议, 颁, 夺, 财, 产, 为, 发, 许, 宪, 现when downloading the pdf.Describe the solution you'd like
I workarounded by hacking codes near
99d10d1189/backend/apps/webui/routers/utils.py (L83)to something like:And I have put NotoSansSC-Regular.ttf from https://fonts.google.com/noto into
backend/static/fonts.This might not be accepted as the general solution however, as it probably breaks displays of some Japanese chars (门、入、内 for example)
Describe alternatives you've considered
Determine the user's locale before executing
pdf.set_fallback_fonts(["NotoSansSC", "NotoSansKR", "NotoSansJP"])to make sure the fallback sequence is correct.Additional context
No additionall context
@tjbck commented on GitHub (Aug 8, 2024):
PR welcome!
@y0umu commented on GitHub (Aug 8, 2024):
I did't propose a pull request in the first place because I cannot come to a conclusion on what is the most suitable approach to fetch the locale.
en_USorClocale .download_chat_as_pdfdoes not seem to have access to request headers at all.@tjbck commented on GitHub (Aug 14, 2024):
what would be the issue of setting it to
["NotoSansKR", "NotoSansJP", "NotoSansSC"]in this order?