1

I automatically generate documents in which users can input any kind of text.

If the user enters chinese characters the text overflows and no line break is occuring.

How can I prohibit the text from overflowing?

(my goal is to generate robust documents in which every character entered is always displayed in the final documents without extra configuration needed)

\definefallbackfamily[mainface][serif][notoserifcjksc][range={cjkunifiedideographs,cjkcompatibility,cjkunifiedideographsextensiona,yijinghexagramsymbols,cjksymbolsandpunctuation}]
\definefallbackfamily[mainface][sans][notosanscjksc][range={cjkunifiedideographs,cjkcompatibility,cjkunifiedideographsextensiona,yijinghexagramsymbols,cjksymbolsandpunctuation}]

\definefallbackfamily[mainface][serif][NotoSerif][range=0x00000-0xFFFFF]
\definefallbackfamily[mainface][sans][NotoSans][range=0x00000-0xFFFFF]

\definefontfamily[mainface][serif][TeX Gyre Pagella]
\definefontfamily[mainface][sans][NotoSans]

\setupbodyfont[mainface]

\starttext

統高比歴写横深原故上現質著毒太念植出使。紙約音予草足資倉報人己読。出黒挑崎成都中場中億芸読。警更追陸手表詰女区力像統稿序。出和開告情恐色番場無料実後調威聞思掲報本。行味半対民未挙大特口佐物久建真容。体姿出全禁委着与帳南氏望真売。告路経就停収通続分政手対康況再官体聞未。制愉北寿載少策聞爆使特埋益。

\stoptext

1 Answer 1

3

You have to enable line breaking for chinese (as well as korean and japanese) text with the \setscript command.

When you have also footnotes in your document which contain chinese text you have to replace the \setscript command with \setglobalscript but it is advised to use the global setting only for documents which chinese only to chinese as the main language.

\setuppapersize [A5]

\definefallbackfamily
  [mainface]
  [serif]
  [notoserifcjksc]
  [range={cjkunifiedideographs,cjkcompatibility,cjkunifiedideographsextensiona,yijinghexagramsymbols,cjksymbolsandpunctuation}]

\definefontfamily [mainface] [serif] [TeX Gyre Pagella]

\setupbodyfont [mainface]

\setscript [hanzi]

\starttext

統高比歴写横深原故上現質著毒太念植出使。
紙約音予草足資倉報人己読。
出黒挑崎成都中場中億芸読。
警更追陸手表詰女区力像統稿序。
出和開告情恐色番場無料実後調威聞思掲報本。
行味半対民未挙大特口佐物久建真容。
体姿出全禁委着与帳南氏望真売。
告路経就停収通続分政手対康況再官体聞未。
制愉北寿載少策聞爆使特埋益。

\stoptext

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .