summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorPeng Guanwen <pg999w@outlook.com>2023-04-13 16:44:39 +0800
committerGitHub <noreply@github.com>2023-04-13 10:44:39 +0200
commitff16f3fb370a1688e59fbbaf8824302d2b2f1a7b (patch)
tree6b62a1a755252b52f6eedf88cd2d5741337d5923 /tests/typ
parent03d2ec9f813cb18c350de78614fcbc269b2dfc96 (diff)
Refine linebreak algorithm for better Chinese justification (#701)
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/layout/par-justify-cjk.typ23
-rw-r--r--tests/typ/layout/par-justify.typ6
2 files changed, 23 insertions, 6 deletions
diff --git a/tests/typ/layout/par-justify-cjk.typ b/tests/typ/layout/par-justify-cjk.typ
new file mode 100644
index 00000000..1016b282
--- /dev/null
+++ b/tests/typ/layout/par-justify-cjk.typ
@@ -0,0 +1,23 @@
+// Test Chinese text in narrow lines.
+
+// In Chinese typography, line length should be multiples of the character size
+// and the line ends should be aligned with each other.
+// Most Chinese publications do not use hanging punctuation at line end.
+#set page(width: auto)
+#set par(justify: true)
+#set text(overhang: false, lang: "zh")
+
+#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[
+ 中文维基百科使用汉字书写,汉字是汉族或华人的共同文字,是中国大陆、新加坡、马来西亚、台湾、香港、澳门的唯一官方文字或官方文字之一。25.9%,而美国和荷兰则分別占13.7%及8.2%。近年來,中国大陆地区的维基百科编辑者正在迅速增加;
+]
+
+---
+// Japanese typography is more complex, make sure it is at least a bit sensible.
+#set page(width: auto)
+#set par(justify: true)
+#set text(lang: "jp")
+#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[
+ ウィキペディア(英: Wikipedia)は、世界中のボランティアの共同作業によって執筆及び作成されるフリーの多言語インターネット百科事典である。主に寄付に依って活動している非営利団体「ウィキメディア財団」が所有・運営している。
+
+ 専門家によるオンライン百科事典プロジェクトNupedia(ヌーペディア)を前身として、2001年1月、ラリー・サンガーとジミー・ウェールズ(英: Jimmy Donal "Jimbo" Wales)により英語でプロジェクトが開始された。
+] \ No newline at end of file
diff --git a/tests/typ/layout/par-justify.typ b/tests/typ/layout/par-justify.typ
index 24d3ab38..7034a42b 100644
--- a/tests/typ/layout/par-justify.typ
+++ b/tests/typ/layout/par-justify.typ
@@ -21,12 +21,6 @@ A B C #linebreak(justify: true)
D E F #linebreak(justify: true)
---
-// Test that justificating chinese text is at least a bit sensible.
-#set page(width: 200pt)
-#set par(justify: true)
-中文维基百科使用汉字书写,汉字是汉族或华人的共同文字,是中国大陆、新加坡、马来西亚、台湾、香港、澳门的唯一官方文字或官方文字之一。25.9%,而美国和荷兰则分別占13.7%及8.2%。近年來,中国大陆地区的维基百科编辑者正在迅速增加;
-
----
// Test that there are no hick-ups with justification enabled and
// basically empty paragraph.
#set par(justify: true)