Dear Wolfgang,
thank you very much for your guidance.
After changing the font settings according to my computer Win10 OS,
the ruby module worked.
But there is another problem, when I use `\setscript[hanzi]`, as follows
%%%begin example
\setscript[hanzi]
\usetypescriptfile[mscore]
\usebodyfont [mschinese,20pt]
\definefont[pinyinfont][name:ahpinying*default at 9pt]
\setupruby[color=darkgray, style=\pinyinfont]
\starttext
\ruby{寖備}{jìn bèi} \ss \ruby{寖備}{jìn bèi} % \tt \ruby{寖備}{jìn bèi}
\stoptext
%%%end example
ruby errors out as follows(that's why I didn't succeed with ruby before):
%%%begin error
……
tex error > tex error on line 1 in file
d:/ah21/TEX/vertical-and-ruby-examples/ruby.lmtx:
lua error:
registered function call [209]:
...n64/tex/texmf-context/tex/context/base/mkxl/typo-rub.lmt:268:
attempt to index a nil value (local 'ruby')
stack traceback:
...n64/tex/texmf-context/tex/context/base/mkxl/typo-rub.lmt:268:
in upvalue 'whatever'
...n64/tex/texmf-context/tex/context/base/mkxl/typo-rub.lmt:370:
in upvalue 'attach'
...n64/tex/texmf-context/tex/context/base/mkxl/typo-rub.lmt:363:
in upvalue 'whatever'
...n64/tex/texmf-context/tex/context/base/mkxl/typo-rub.lmt:370:
in upvalue 'attach'
... (skipping 27 levels)
...n64/tex/texmf-context/tex/context/base/mkxl/typo-rub.lmt:363:
in upvalue 'whatever'
...n64/tex/texmf-context/tex/context/base/mkxl/typo-rub.lmt:370:
in upvalue 'typesetters_rubies_attach'
[string "local tonut = nodes.tonut..."]:20: in function
<[string "local tonut = nodes.tonut..."]:11>
(...tail calls...)
[string
"D:/venvs/context-win64/tex/texmf-context/tex/..."]:38: in function
<[string "D:/venvs/context-win64/tex/texmf-context/tex/..."]:37>
(...tail calls...)
1 >> \setscript[hanzi]
……
%%%end error
Best regards,
Huang Fusyong(黄复雄)
Wolfgang Schuster via ntg-context
黄复雄 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
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context webpage : https://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : https://contextgarden.net ___________________________________________________________________________________