mirror of
https://github.com/typst/typst
synced 2025-08-23 03:04:14 +08:00
deal with zero case in fixed scheme
This commit is contained in:
parent
763fdc44d5
commit
29cc4a23e7
@ -640,16 +640,16 @@ impl NumberingKind {
|
|||||||
),
|
),
|
||||||
Self::CircledNumber => fixed(
|
Self::CircledNumber => fixed(
|
||||||
[
|
[
|
||||||
'①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬', '⑭',
|
'⓪', '①', '②', '③', '④', '⑤', '⑥', '⑦', '⑧', '⑨', '⑩', '⑪', '⑫', '⑬',
|
||||||
'⑮', '⑯', '⑰', '⑱', '⑲', '⑳', '㉑', '㉒', '㉓', '㉔', '㉕', '㉖',
|
'⑭', '⑮', '⑯', '⑰', '⑱', '⑲', '⑳', '㉑', '㉒', '㉓', '㉔', '㉕',
|
||||||
'㉗', '㉘', '㉙', '㉚', '㉛', '㉜', '㉝', '㉞', '㉟', '㊱', '㊲',
|
'㉖', '㉗', '㉘', '㉙', '㉚', '㉛', '㉜', '㉝', '㉞', '㉟', '㊱',
|
||||||
'㊳', '㊴', '㊵', '㊶', '㊷', '㊸', '㊹', '㊺', '㊻', '㊼', '㊽',
|
'㊲', '㊳', '㊴', '㊵', '㊶', '㊷', '㊸', '㊹', '㊺', '㊻', '㊼',
|
||||||
'㊾', '㊿',
|
'㊽', '㊾', '㊿',
|
||||||
],
|
],
|
||||||
n,
|
n,
|
||||||
),
|
),
|
||||||
Self::DoubleCircledNumber => {
|
Self::DoubleCircledNumber => {
|
||||||
fixed(['⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾'], n)
|
fixed(['0', '⓵', '⓶', '⓷', '⓸', '⓹', '⓺', '⓻', '⓼', '⓽', '⓾'], n)
|
||||||
}
|
}
|
||||||
|
|
||||||
Self::LowerSimplifiedChinese => {
|
Self::LowerSimplifiedChinese => {
|
||||||
@ -777,8 +777,8 @@ fn alphabetic<const N_DIGITS: usize>(symbols: [char; N_DIGITS], mut n: u64) -> E
|
|||||||
/// ```
|
/// ```
|
||||||
fn fixed<const N_DIGITS: usize>(symbols: [char; N_DIGITS], n: u64) -> EcoString {
|
fn fixed<const N_DIGITS: usize>(symbols: [char; N_DIGITS], n: u64) -> EcoString {
|
||||||
let n_digits = N_DIGITS as u64;
|
let n_digits = N_DIGITS as u64;
|
||||||
if n - 1 < n_digits {
|
if n < n_digits {
|
||||||
return symbols[(n - 1) as usize].into();
|
return symbols[(n) as usize].into();
|
||||||
}
|
}
|
||||||
eco_format!("{n}")
|
eco_format!("{n}")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user