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

Thai text does not correctly wrap (words should wrap on zero width space) #441

Open
carlhiggs opened this issue Jun 3, 2024 · 1 comment

Comments

@carlhiggs
Copy link
Collaborator

I have lodged an issue describing this upstream at fpdf2:
py-pdf/fpdf2#1190

In short, instead of Thai text wrapping correctly like it does in browser

นโยบาย​สาธารณะ​มี​ความ​สำคัญ​ต่อ​การ​สนับสนุน​การ​ออก​แบบ​และ​การ​สร้าง​ชุมชน​และ​เมือง​สุขภาพ​ดี​และ​ยั่งยืน รายการ​ตรวจ​สอบนโยบาย​ความ​ท้าทาย 1,000 เมือง​สำหรับ​ใช้​เพื่อ​ประเมิน​การ​มี​อยู่​และ​คุณภาพ​ของ​นโยบาย​ที่​สอด​คล้อง​กับ​หลัก​ฐาน​และ​หลัก​การ​สำหรับ​เมือง​ที่​มี​สุขภาพ​ดี​และ​ยั่งยืน

it doesn't break on zero-width spaces and instead only breaks on visible spaces when rendered as a pdf, e.g.:
image.

Thai uses spaces like punctuation, not to seperate words, and so inserting spaces to manually induce word wrapping isn't a viable solution as it would impact meaning.

I think it might be a simple fix (allow wrapping on zero-width spaces), or its possible I have misunderstood the problem. I'll wait to hear if anyone has any advice, and if not, i'll attempt to fix in code.

@carlhiggs
Copy link
Collaborator Author

It took a while, but with guidance of the package maintainers I was finally able to implement this feature in the upstream FPDF software we use (py-pdf/fpdf2#1191). I believe a new release of the software will be made soon, and once availabel on conda-forge, I will update things to make use of it. This will help city teams from countries with the languages and scripts that use spaces or symbols other than " " to break words generate reports for their local audiences (e.g. Thai, Lao, Burmese and other languages).

Once this has been incorporated into our Docker software image and used within an updated version of our software, I'll close this issue.

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

No branches or pull requests

1 participant