Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?
Typesetting furigana over kanji characters is common for japanese educational materials. Is this doable in ConTeXt?
On 15 Aug 2022, at 13:02, amano.kenji via ntg-context
wrote: Typesetting furigana over kanji characters is common for japanese educational materials.
Yes, using the \ruby command. That used to require a module, but is now in the core. The wiki page on CJK fonts should probably be updated (new fonts, broken ftp links, etc.) but at least it mentions this: https://wiki.contextgarden.net/CJK_fonts Best wishes, Taco — Taco Hoekwater E: taco@bittext.nl genderfluid (all pronouns)
Is there any documentation about \ruby? What about vertical text?
------- Original Message -------
On Monday, August 15th, 2022 at 11:43 AM, Taco Hoekwater
On 15 Aug 2022, at 13:02, amano.kenji via ntg-context ntg-context@ntg.nl wrote:
Typesetting furigana over kanji characters is common for japanese educational materials.
Yes, using the \ruby command. That used to require a module, but is now in the core.
The wiki page on CJK fonts should probably be updated (new fonts, broken ftp links, etc.) but at least it mentions this:
https://wiki.contextgarden.net/CJK_fonts
Best wishes, Taco
— Taco Hoekwater E: taco@bittext.nl genderfluid (all pronouns)
amano.kenji via ntg-context schrieb am 15.08.2022 um 14:00:
Is there any documentation about \ruby?
You can see all available parameters in setup-en.pdf, the example below shows a few of them: %%%% begin example \setupinterlinespace[line=4ex] \setuptype[style=\ttx] \starttext \start xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop \start \setupruby[location=left] \type{\setupruby[location=left]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop \start \setupruby[location=right] \type{\setupruby[location=right]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop \start \setupruby[location=right,left={[},right={]}] \type{\setupruby[left={[},right={]}]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop \start \setupruby[align=flushleft] \type{\setupruby[align=flushleft]}\quad xxxxxxxxx \ruby{aaaaaa}{bbb} xxxxxxxxx \stop \start \setupruby[align=flushright] \type{\setupruby[align=flushright]}\quad xxxxxxxxx \ruby{aaaaaa}{bbb} xxxxxxxxx \stop \start \setupruby[style=\itxx] \type{\setupruby[style=\itxx]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop \start \setupruby[color=blue] \type{\setupruby[color=blue]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop \start \setupruby[voffset=-1.2ex] \type{\setupruby[voffset=-1.2ex]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop \stoptext %%%% end example
What about vertical text?
ConTeXt has a mechanism to produce vertical text but there is nothing yet which can be used out of the box to produce a complete document with vertical paragraphs. Wolfgang
At least, furigana seems covered.
How do I know which document to consult? There are many PDF files that come with ConTeXt.
------- Original Message -------
On Monday, August 15th, 2022 at 3:39 PM, Wolfgang Schuster via ntg-context
amano.kenji via ntg-context schrieb am 15.08.2022 um 14:00:
Is there any documentation about \ruby?
You can see all available parameters in setup-en.pdf, the example below shows a few of them:
%%%% begin example \setupinterlinespace[line=4ex]
\setuptype[style=\ttx]
\starttext
\start xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[location=left] \type{\setupruby[location=left]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[location=right] \type{\setupruby[location=right]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[location=right,left={[},right={]}] \type{\setupruby[left={[},right={]}]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[align=flushleft] \type{\setupruby[align=flushleft]}\quad xxxxxxxxx \ruby{aaaaaa}{bbb} xxxxxxxxx \stop
\start \setupruby[align=flushright] \type{\setupruby[align=flushright]}\quad xxxxxxxxx \ruby{aaaaaa}{bbb} xxxxxxxxx \stop
\start \setupruby[style=\itxx] \type{\setupruby[style=\itxx]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[color=blue] \type{\setupruby[color=blue]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[voffset=-1.2ex] \type{\setupruby[voffset=-1.2ex]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\stoptext %%%% end example
What about vertical text?
ConTeXt has a mechanism to produce vertical text but there is nothing yet which can be used out of the box to produce a complete document with vertical paragraphs.
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 ___________________________________________________________________________________
amano.kenji schrieb am 16.08.2022 um 13:33:
At least, furigana seems covered.
How do I know which document to consult? There are many PDF files that come with ConTeXt.
You can start with the following thread from 2020: https://mailman.ntg.nl/pipermail/ntg-context/2020/098389.html Useful documents are (both are part of your context installation): - http://www.pragma-ade.nl/general/manuals/followingup.pdf - https://www.pragma-ade.nl/general/manuals/lowlevel-boxes.pdf Wolfgang
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}
```
BTW, I hav made a vertical typesetting module for Chinese in ConTeXt LMTX,
vertical_typeset.lua in https://github.com/Fusyong/vertical-typesetting
You should modify the set for Japanese characters and punctuations here:
```lua
local function chars_to_vertical(c)
return c >= 0x04E00 and c <= 0x09FFF
end
local puncs_to_rotate = {
[0x3001] = true, -- 、
[0xFF0C] = true, -- ,
[0x3002] = true, -- 。
[0xFF0E] = true, -- .
[0xFF1F] = true, -- ?
[0xFF01] = true, -- !
[0xFF1A] = true, -- :
[0xFF1B] = true, -- ;
}
```
and there is a doc for example, 大学章句.lmtx, in https://github.com/Fusyong/jiazhu,
and jiazhu.lua in same place is a module of Jiazhu (or 夹注, 割注) in ConTeXt LMTX.
But all the comments are in Chinese.
amano.kenji via ntg-context
At least, furigana seems covered.
How do I know which document to consult? There are many PDF files that come with ConTeXt.
------- Original Message ------- On Monday, August 15th, 2022 at 3:39 PM, Wolfgang Schuster via ntg-context
wrote: amano.kenji via ntg-context schrieb am 15.08.2022 um 14:00:
Is there any documentation about \ruby?
You can see all available parameters in setup-en.pdf, the example below shows a few of them:
%%%% begin example \setupinterlinespace[line=4ex]
\setuptype[style=\ttx]
\starttext
\start xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[location=left] \type{\setupruby[location=left]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[location=right] \type{\setupruby[location=right]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[location=right,left={[},right={]}] \type{\setupruby[left={[},right={]}]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[align=flushleft] \type{\setupruby[align=flushleft]}\quad xxxxxxxxx \ruby{aaaaaa}{bbb} xxxxxxxxx \stop
\start \setupruby[align=flushright] \type{\setupruby[align=flushright]}\quad xxxxxxxxx \ruby{aaaaaa}{bbb} xxxxxxxxx \stop
\start \setupruby[style=\itxx] \type{\setupruby[style=\itxx]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[color=blue] \type{\setupruby[color=blue]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\start \setupruby[voffset=-1.2ex] \type{\setupruby[voffset=-1.2ex]}\quad xxxxxxxxx \ruby{aaa}{bbb} xxxxxxxxx \stop
\stoptext %%%% end example
What about vertical text?
ConTeXt has a mechanism to produce vertical text but there is nothing yet which can be used out of the box to produce a complete document with vertical paragraphs.
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 ___________________________________________________________________________________
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 ___________________________________________________________________________________
Currently, the ruby module does not seem to support cjk fonts? I have a preliminary implementation of furigana(pinyin in Chinese) as: Actually a few years ago I added some basic new features for doing vertical scripts effciently but (as often with these things) there was not that much follow up because no one seems to need / use it (or be
On 8/21/2022 10:24 AM, 黄复雄 via ntg-context wrote: triggered by the fact that it can be used). The attached files show two methods ... manual work as well as semi automatic (one needs to patch one font file for some recent optimizations). As you can see, rubies work ok. Now, before trying to improve this, it makes more sense to think about what kind of vertical support is actually needed becaus in order for that to work ok it really has to work with other mechanism as well and there is only so much that tex can do. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
黄复雄 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
黄复雄 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: attached a variant (no pdf attached) using wolfgangs font definition
On 8/21/2022 12:10 PM, Wolfgang Schuster via ntg-context wrote: plus some more ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Dear Hans.
Thank you very much for so many examples and guidance.
In fact, I have read one of the examples in the followingup.pdf,
and the https://github.com/Fusyong/vertical-typesetting module I made
is based on the example.
The examples all worked after I changed the font settings according to
my Win10 OS;
and surprisingly, the ruby module also worked with \setscript[hanzi]
(they don't work together in the example Mr. Wolfgang provided).
The only problem is that the offsets of glyphs are a bit inaccurate,
which may be related to the font,
and I will look into it further.
The examples I have adjusted are attached,
and the output PDF of them is not attached for being too big to the
limit of 100 KB.
(Just now I received a reply from the mailing list system asking to
adjust a over-length email,
I mistakenly thought it was about the one to Mr. Wolfgang, so that one
was duplicated and submitted,
please deal with it.)
By the way, I've finished checking and adjusting type-imp-mscore.mkiv,
scrp-cjk.lua, and char-scr.lua so far,
but the changes are a bit much (or maybe you can say a bit reckless),
so I'm hesitant to get back to you in order to minimize your troubles.
And as mentioned partly in an earlier email, I've made 3 modules that
support Chinese
(about vertical-typesetting, Jiazhu or inline cutting note and punctuation)
and I'd be happy to contribute them to the ConTeXt project repository
when they're ripe,
if that's in line with the project policy. Your comments and guidance
are very welcome.
Best regards,
Huang Fusyong(黄复雄)
Hans Hagen 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: attached a variant (no pdf attached) using wolfgangs font definition
On 8/21/2022 12:10 PM, Wolfgang Schuster via ntg-context wrote: plus some more
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------___________________________________________________________________________________ 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 ___________________________________________________________________________________
On 8/22/2022 7:21 AM, 黄复雄 via ntg-context wrote:
Dear Hans. Thank you very much for so many examples and guidance.
In fact, I have read one of the examples in the followingup.pdf, and the https://github.com/Fusyong/vertical-typesetting module I made is based on the example.
The examples all worked after I changed the font settings according to my Win10 OS; and surprisingly, the ruby module also worked with \setscript[hanzi] (they don't work together in the example Mr. Wolfgang provided).
I noticed an issu ewith multiple glyphs but am not sure why ... (so we need very small examples to figure it out).
The only problem is that the offsets of glyphs are a bit inaccurate, which may be related to the font, and I will look into it further.
in the vertical feature one can tune a bit.
The examples I have adjusted are attached, and the output PDF of them is not attached for being too big to the limit of 100 KB. (Just now I received a reply from the mailing list system asking to adjust a over-length email, I mistakenly thought it was about the one to Mr. Wolfgang, so that one was duplicated and submitted, please deal with it.)
there are indeed limits
By the way, I've finished checking and adjusting type-imp-mscore.mkiv, scrp-cjk.lua, and char-scr.lua so far, but the changes are a bit much (or maybe you can say a bit reckless), so I'm hesitant to get back to you in order to minimize your troubles. And as mentioned partly in an earlier email, I've made 3 modules that support Chinese (about vertical-typesetting, Jiazhu or inline cutting note and punctuation) and I'd be happy to contribute them to the ConTeXt project repository when they're ripe, if that's in line with the project policy. Your comments and guidance are very welcome.
hm, i can have a look at it but we shouldn't break japanese and korean once you finished all we can see how it can either be integrated or become some third party module (has to do with maintainance) can you also make a noto typescript for the different chinese setups (for some reason the CJK noto's failed so i used the non CJK ones as i couldn't locate the right files; one cannot longher download al-of-noto in one zip ) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
I noticed an issue with multiple glyphs but am not sure why ... (so we need very small examples to figure it out).
I have observed a phenomenon that when the base text contains glues/spaces, an error occurs, as in the following example. Coincidentally, when using \setscript[hanzi], the macro will inject glue between Chinese, and I will get the same error. %%%begin example \starttext \ruby{a a}{b} \stoptext %%%end example Best Regards, 黄复雄(Huang Fuysong) ___________________________________________________________________________________ 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 ___________________________________________________________________________________
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
resolvers | formats | executing runner 'run luametatex format':
D:/venvs/context-win64/tex/texmf-win64/bin/luametatex
--jobname="d:/ah21/TEX/vertical-and-ruby-examples/ruby.lmtx"
--fmt=D:/venvs/context-win64/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.fmt
--lua=D:/venvs/context-win64/tex/texmf-cache/luametatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e/formats/luametatex/cont-en.lui
--c:currentrun=1
--c:fulljobname="d:/ah21/TEX/vertical-and-ruby-examples/ruby.lmtx"
--c:input="d:/ah21/TEX/vertical-and-ruby-examples/ruby.lmtx"
--c:kindofrun=1 --c:maxnofruns=9
--c:texmfbinpath="D:/venvs/context-win64/tex/texmf-win64/bin"
system >
system > ConTeXt ver: 2022.07.27 17:56 LMTX fmt: 2022.8.22
int: english/english
system >
system > 'cont-new.mkxl' loaded
open source > level 1, order 1, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system > beware: some patches loaded from cont-new.mkiv
close source > level 1, order 1, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl'
system > files > jobname
'd:/ah21/TEX/vertical-and-ruby-examples/ruby', input
'd:/ah21/TEX/vertical-and-ruby-examples/ruby.lmtx', result
'd:/ah21/TEX/vertical-and-ruby-examples/ruby'
fonts > latin modern fonts are not preloaded
languages > language 'en' is active
open source > level 1, order 2, name
'd:/ah21/TEX/vertical-and-ruby-examples/ruby.lmtx'
fonts > bodyfont '20pt' is defined (can better be done global)
fonts > bodyfont '24pt' is defined (can better be done global)
fonts > bodyfont '16pt' is defined (can better be done global)
open source > level 2, order 3, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-mscore.mkiv'
close source > level 2, order 3, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-mscore.mkiv'
open source > level 2, order 4, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-cambria.mkiv'
open source > level 3, order 5, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-dejavu.mkiv'
close source > level 3, order 5, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-dejavu.mkiv'
close source > level 2, order 5, name
'D:/venvs/context-win64/tex/texmf-context/tex/context/fonts/mkiv/type-imp-cambria.mkiv'
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'
...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'
...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'
...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 14 levels)
...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'
...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'
...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'
...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]
2
3 \usetypescriptfile[mscore]
4 \usebodyfont [mschinese,20pt]
5 %
6 \definefont[pinyinfont][name:ahpinying*default at 9pt]
7 %
8 \setupruby[color=darkgray, style=\pinyinfont]
9
10 \starttext
11 \ruby{寖備}{jìn bèi} \ss \ruby{寖備}{jìn bèi} %\tt \ruby{寖備}{jìn bèi}
mtx-context | fatal error: return code: 1
%%%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 ___________________________________________________________________________________
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 ___________________________________________________________________________________
participants (5)
-
amano.kenji
-
Hans Hagen
-
Taco Hoekwater
-
Wolfgang Schuster
-
黄复雄