brechtm / rinohtype

The Python document processor
http://www.mos6581.org/rinohtype
GNU Affero General Public License v3.0
499 stars 59 forks source link

No line break for paragraphs with only Chinese characters #327

Open infomagic-docs opened 2 years ago

infomagic-docs commented 2 years ago

When using Rinoh type for PDF for RST docs in Chinese as paragraphs (normally no space between characters by nature), the paragraphs in the generated PDF have no line break and exceed the page (as shown in the first paragraph in the screenshot). When generating the docs, a "item too long to fit on line" error is displayed.

Do you have any ideas on how to fix this? We tried editing styles like width, ligatures, etc., but got no luck.

If we add white spaces in the paragraphs (the second paragraph in the screenshot), the paragraph breaks at the whitespaces. There's no issue with a pure English paragraph.

image image

Content in the RST file for testing: 纯中文不换行文本。纯文本格式,就是没有任何文本修饰的,没有任何粗体,下划线,斜体,图形,符号或特殊字符及特殊打印格式的文本,只保存文本,不保存其格式设置。将所有的分节符、分页符、新行字符转换为段落标记。

纯中文换行文本:纯文本格式,就是没有任何文本修饰的,没有任何粗体,下划线,斜体,图 形,符号或特殊字符及特殊打印格式的文本,只保存文本,不保存其格式设置。将所有的分节 符、分页符、新行字符转换为段落标记。

Please also provide the following information:

brechtm commented 2 years ago

rinohtype will only break lines on spaces currently. I'm thinking this could relatively easily be changed depending on the language set for the document. It would be great if rinohtype could render Chinese documents!

I was trying to reproduce this issue, but I haven't been able to find a typeface including Chinese characters that will not crash rinohtype on loading. I tried rinoh-typeface-notosanscjk and Noto Serif SC Which typeface did you use?