summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Guanwen <pg999w@outlook.com>2023-05-15 14:57:17 +0800
committerGitHub <noreply@github.com>2023-05-15 08:57:17 +0200
commit659f27bf6a183876ed8f4608144f4ba7740a5eb3 (patch)
treed9a4c3d7a2e21491fd8143d8965dc45e8363d8f5
parentcb33b96426216bbf5cf978c4da1878a6ab548b04 (diff)
Do not hang CJK punctuation (#1211)
-rw-r--r--library/src/layout/par.rs3
-rw-r--r--tests/typ/layout/par-justify-cjk.typ6
2 files changed, 4 insertions, 5 deletions
diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs
index 96d45f2f..f87b23d8 100644
--- a/library/src/layout/par.rs
+++ b/library/src/layout/par.rs
@@ -1473,9 +1473,8 @@ fn overhang(c: char) -> f64 {
'.' | ',' => 0.8,
':' | ';' => 0.3,
- // Arabic and Ideographic
+ // Arabic
'\u{60C}' | '\u{6D4}' => 0.4,
- '\u{3001}' | '\u{3002}' => 1.0,
_ => 0.0,
}
diff --git a/tests/typ/layout/par-justify-cjk.typ b/tests/typ/layout/par-justify-cjk.typ
index 8ceab65f..04b328a7 100644
--- a/tests/typ/layout/par-justify-cjk.typ
+++ b/tests/typ/layout/par-justify-cjk.typ
@@ -5,7 +5,7 @@
// Most Chinese publications do not use hanging punctuation at line end.
#set page(width: auto)
#set par(justify: true)
-#set text(font: "Noto Serif CJK SC", lang: "zh", overhang: false)
+#set text(font: "Noto Serif CJK SC", lang: "zh")
#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[
中文维基百科使用汉字书写,汉字是汉族或华人的共同文字,是中国大陆、新加坡、马来西亚、台湾、香港、澳门的唯一官方文字或官方文字之一。25.9%,而美国和荷兰则分別占13.7%及8.2%。近年來,中国大陆地区的维基百科编辑者正在迅速增加;
@@ -25,7 +25,7 @@
---
// Test punctuation whitespace adjustment
#set page(width: auto)
-#set text(lang: "zh", font: "Noto Serif CJK SC", overhang: false)
+#set text(lang: "zh", font: "Noto Serif CJK SC")
#set par(justify: true)
#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[
“引号测试”,还,
@@ -40,7 +40,7 @@
// 17 characters a line.
#set page(width: 170pt + 10pt, margin: (x: 5pt))
-#set text(font: "Noto Serif CJK SC", lang: "zh", overhang: false)
+#set text(font: "Noto Serif CJK SC", lang: "zh")
#set par(justify: true)
孔雀最早见于《山海经》中的《海内经》:\u{200b}“有孔雀。”东汉杨孚著《异物志》记载,岭南:“孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。”