黄复雄 via ntg-context schrieb am 21.08.2022 um 10:24:
Currently, the ruby module does not seem to support cjk fonts? I have a preliminary implementation of furigana(pinyin in Chinese) as:
```lmtx % define the pinyin font \definefont[pinyinfont][name:ahpinying*default at 9pt] % define the pinyin command \define[2]\pinyin{% \setbox1 = \hbox{#1}% \setbox2 = \hbox{\darkgray \pinyinfont #2}% \newdimen\maxwd% \ifdim \wd1>\wd2 \maxwd=\wd1 \else \maxwd=\wd2 \fi% \setbox1 = \hbox to \maxwd{\hfill \box1 \hfill}% \setbox2 = \hbox to \maxwd{\hfill \box2 \hfill}% \hskip0pt plus5pt\vbox{\setupinterlinespace[line=0.5em]\box2\box1}% above line % \hskip0pt plus5pt\vtop{\setupinterlinespace[line=0.5em]\box1\box2}% under line } ``` usage as follows:
```lmtx \pinyin{寖備}{jìn bèi} ```
The ruby command has no problem with chinese but you need a font which has support for it. As can be seen in my previous example you can use the style-key to switch to a different font for the annotation (e.g. \setupruby[style=\pinyinfont]). %%%% begin example \definefallbackfamily [documentfont] [rm] [Noto Serif CJK SC] [preset=range:chinese] \definefallbackfamily [documentfont] [ss] [Noto Sans CJK SC] [preset=range:chinese] \definefallbackfamily [documentfont] [tt] [Noto Sans Mono CJK SC] [preset=range:chinese] \definefontfamily [documentfont] [rm] [Noto Serif] \definefontfamily [documentfont] [ss] [Noto Sans] \definefontfamily [documentfont] [tt] [Noto Sans Mono] \setupbodyfont [documentfont] \setupruby[color=darkgray] \starttext \ruby{寖備}{jìn bèi} \ss \ruby{寖備}{jìn bèi} \tt \ruby{寖備}{jìn bèi} \stoptext %%%% end example Wolfgang