summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/fonts/NotoSerifCJKkr-Regular.otfbin0 -> 2897996 bytes
-rw-r--r--library/src/meta/numbering.rs28
-rw-r--r--tests/ref/meta/numbering.pngbin35430 -> 48098 bytes
-rw-r--r--tests/typ/layout/par-justify-cjk.typ8
-rw-r--r--tests/typ/meta/numbering.typ24
-rw-r--r--tests/typ/text/lang-with-region.typ6
6 files changed, 56 insertions, 10 deletions
diff --git a/assets/fonts/NotoSerifCJKkr-Regular.otf b/assets/fonts/NotoSerifCJKkr-Regular.otf
new file mode 100644
index 00000000..b79606bb
--- /dev/null
+++ b/assets/fonts/NotoSerifCJKkr-Regular.otf
Binary files differ
diff --git a/library/src/meta/numbering.rs b/library/src/meta/numbering.rs
index 7ba27aaa..fbe7306c 100644
--- a/library/src/meta/numbering.rs
+++ b/library/src/meta/numbering.rs
@@ -38,7 +38,7 @@ pub fn numbering(
/// Defines how the numbering works.
///
/// **Counting symbols** are `1`, `a`, `A`, `i`, `I`, `い`, `イ`,
- /// `א`, and `*`. They are replaced by the number in the sequence,
+ /// `א`, `가`, `ㄱ`, and `*`. They are replaced by the number in the sequence,
/// in the given case.
///
/// The `*` character means that symbols should be used to count, in the
@@ -132,7 +132,7 @@ cast_to_value! {
/// How to turn a number into text.
///
/// A pattern consists of a prefix, followed by one of `1`, `a`, `A`, `i`,
-/// `I`, `い`, `イ`, `א`, or `*`, and then a suffix.
+/// `I`, `い`, `イ`, `א`, `가`, `ㄱ`, or `*`, and then a suffix.
///
/// Examples of valid patterns:
/// - `1)`
@@ -269,6 +269,8 @@ enum NumberingKind {
TraditionalChinese,
HiraganaIroha,
KatakanaIroha,
+ KoreanJamo,
+ KoreanSyllable,
}
impl NumberingKind {
@@ -283,6 +285,8 @@ impl NumberingKind {
'一' | '壹' => NumberingKind::SimplifiedChinese,
'い' => NumberingKind::HiraganaIroha,
'イ' => NumberingKind::KatakanaIroha,
+ 'ㄱ' => NumberingKind::KoreanJamo,
+ '가' => NumberingKind::KoreanSyllable,
_ => return None,
})
}
@@ -299,6 +303,8 @@ impl NumberingKind {
Self::TraditionalChinese => '一',
Self::HiraganaIroha => 'い',
Self::KatakanaIroha => 'イ',
+ Self::KoreanJamo => 'ㄱ',
+ Self::KoreanSyllable => '가',
}
}
@@ -464,6 +470,24 @@ impl NumberingKind {
Err(_) => '-'.into(),
}
}
+ Self::KoreanJamo => zeroless::<14>(
+ |x| {
+ [
+ 'ㄱ', 'ㄴ', 'ㄷ', 'ㄹ', 'ㅁ', 'ㅂ', 'ㅅ', 'ㅇ', 'ㅈ', 'ㅊ', 'ㅋ',
+ 'ㅌ', 'ㅍ', 'ㅎ',
+ ][x]
+ },
+ n,
+ ),
+ Self::KoreanSyllable => zeroless::<14>(
+ |x| {
+ [
+ '가', '나', '다', '라', '마', '바', '사', '아', '자', '차', '카',
+ '타', '파', '하',
+ ][x]
+ },
+ n,
+ ),
}
}
}
diff --git a/tests/ref/meta/numbering.png b/tests/ref/meta/numbering.png
index 8ddf3324..ff521e25 100644
--- a/tests/ref/meta/numbering.png
+++ b/tests/ref/meta/numbering.png
Binary files differ
diff --git a/tests/typ/layout/par-justify-cjk.typ b/tests/typ/layout/par-justify-cjk.typ
index 41b3e729..2791769b 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")
+#set text(lang: "zh", font: "Noto Serif CJK SC")
#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[
中文维基百科使用汉字书写,汉字是汉族或华人的共同文字,是中国大陆、新加坡、马来西亚、台湾、香港、澳门的唯一官方文字或官方文字之一。25.9%,而美国和荷兰则分別占13.7%及8.2%。近年來,中国大陆地区的维基百科编辑者正在迅速增加;
@@ -15,7 +15,7 @@
// 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")
+#set text(lang: "jp", font: ("Linux Libertine", "Noto Serif CJK JP"))
#rect(inset: 0pt, width: 80pt, fill: rgb("eee"))[
ウィキペディア(英: Wikipedia)は、世界中のボランティアの共同作業によって執筆及び作成されるフリーの多言語インターネット百科事典である。主に寄付に依って活動している非営利団体「ウィキメディア財団」が所有・運営している。
@@ -40,10 +40,10 @@
// 17 characters a line.
#set page(width: 170pt + 10pt, margin: (x: 5pt))
-#set text(font: "Noto Serif CJK SC", lang: "zh")
+#set text(lang: "zh", font: "Noto Serif CJK SC")
#set par(justify: true)
孔雀最早见于《山海经》中的《海内经》:“有孔雀。”东汉杨孚著《异物志》记载,岭南:“孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。”
-#set text(font: "Noto Serif CJK TC", lang: "zh", region: "hk")
+#set text(lang: "zh", region: "hk", font: "Noto Serif CJK TC")
孔雀最早见于《山海经》中的《海内经》:「有孔雀。」东汉杨孚著《异物志》记载,岭南:「孔雀,其大如大雁而足高,毛皆有斑纹彩,捕而蓄之,拍手即舞。」
diff --git a/tests/typ/meta/numbering.typ b/tests/typ/meta/numbering.typ
index e243e035..9bb3c5d9 100644
--- a/tests/typ/meta/numbering.typ
+++ b/tests/typ/meta/numbering.typ
@@ -32,7 +32,7 @@
}
---
-#set text(lang: "zh")
+#set text(lang: "zh", font: ("Linux Libertine", "Noto Serif CJK SC"))
#for i in range(9,21, step: 2){
numbering("一", i)
[ and ]
@@ -41,6 +41,7 @@
}
---
+#set text(lang: "jp", font: ("Linux Libertine", "Noto Serif CJK JP"))
#for i in range(0, 4) {
numbering("イ", i)
[ (or ]
@@ -61,5 +62,26 @@
}
---
+#set text(lang: "ko", font: ("Linux Libertine", "Noto Serif CJK KR"))
+#for i in range(0, 4) {
+ numbering("가", i)
+ [ (or ]
+ numbering("ㄱ", i)
+ [) for #i \ ]
+}
+... \
+#for i in range(47, 51) {
+ numbering("가", i)
+ [ (or ]
+ numbering("ㄱ", i)
+ [) for #i \ ]
+}
+... \
+#for i in range(2256, 2260) {
+ numbering("ㄱ", i)
+ [ for #i \ ]
+}
+
+---
// Error: 17-19 number must be at least zero
#numbering("1", -1)
diff --git a/tests/typ/text/lang-with-region.typ b/tests/typ/text/lang-with-region.typ
index 344ca8d2..f890a00f 100644
--- a/tests/typ/text/lang-with-region.typ
+++ b/tests/typ/text/lang-with-region.typ
@@ -2,15 +2,15 @@
---
// without any region
-#set text(lang: "zh")
+#set text(font: "Noto Serif CJK TC", lang: "zh")
#outline()
---
// with unknown region configured
-#set text(lang: "zh", region: "XX")
+#set text(font: "Noto Serif CJK TC", lang: "zh", region: "XX")
#outline()
---
// with region configured
-#set text(lang: "zh", region: "TW")
+#set text(font: "Noto Serif CJK TC", lang: "zh", region: "TW")
#outline()