chiandiau
(腔調, Chinese tone of voice; Shanghainese model behavior) is a Typst package to generate Jumpy Pronunciation (跳跳紮注音) for any Chinese variaties or any other toned languages using Chao tone letters.
Quick start
#import "@preview/chiandiau:0.1.0": *
#wuu-wugniu(
"新冠防护勿放松,上海市民有腔调",
"1shin-kuoe 6vaon-wu 6veq8-faon-son 6zaon-he 6zy-min 6yeu 1chian-diau",
// optional parameters
pron-font: ..., // custom font (name / list) for pronunciation
// see below for more
)
Examples
… of all available pre-defined writing systems. Check the repo on GitHub for demo.typ
.
Built-in schemes
cmn
:nan
: 臺灣台語羅馬字nan-tailo
(compatible with Pe̍h-ōe-jī)wuu
: 吳語學堂拼音wuu-wugniu
- append
\
and tone after a syllable, like8geh-soh7\55
to makesoh
become55
scheme
: seewuu.typ
on how to pass custom schemes
- append
yue
: 粤拼yue-jyutping
Additionally, all schemes accepts ..attrs
that will be passed to cd()
(see below).
Advanced usage
Write a new scheme
#let cmn-pinyin-scheme = (
none,
55,
35,
214, // unimplemented; use 14
53,
)
#let cmn-pinyin(zh, pron, ..attrs) = {
let pairs = to-pairs(zh, pron)
cd(
pairs,
scheme: to-scheme(cmn-pinyin-scheme),
..attrs
)
}
to-scheme
and to-pairs
cannot handle those with tone sandhi, so this sample will not deal with morphemes like 不 (bù; ‘not’) and 一 (yī; ‘one’). in Standard Chinese. Use to-sandhi-pairs
instead.
Use cd()
cd
accepts either:
pairs: (zi: str, pron: str)
+scheme: (pron: str) => conter
, orpairs: (zi: str, pron: str, conter: int)
.
Here conter means the Chao tone number like $1$, $35$, $42$, etc.
Optional parameters
dir: direction.btt, // note that zi is before pron
pron-font: context text.font, // or font name / list
pron-size: .4em, // of zi font size which is .4em of 2em = .8em
width: "monospace", // or `auto` or fixed value like `1.2em`
pron-style: none, // or a function
debug: false, // show border of boxes
Roadmap
- [ ] 3-digit tone numbers
- [ ] Tone sandhi by character
- [ ] More built-in schemes
- [ ] Backgrounds for tone boxes
Contributing
Feedback, bugfix, or new scheme support are all welcome!
Acknowledgement
- Hambaanglaang Cantonese and 粵典 for Graphical Jyutping.
- Subaru ad Astra Pø (@subaruphoe) for providing and checking Wugniu.
- Wiktionary wuu-pron data, CC BY-SA 4.0.
- justfont for jf open-huninn, which supports Pe̍h-ōe-jī letters.
License
The source code is released under the Apache 2.0 License.