ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "黄复雄 via ntg-context" <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: 黄复雄 <aahuaang@gmail.com>
Subject: Re: Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?
Date: Mon, 22 Aug 2022 10:09:19 +0800	[thread overview]
Message-ID: <CAHN0TNgW6muzt5XCfj0QKxCaSuBo=9VX4XgE5t43Akj59t+QMw@mail.gmail.com> (raw)
In-Reply-To: <011c9bde-bc0c-b15f-53a5-a51d4b8f3728@gmail.com>

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 <ntg-context@ntg.nl> 于2022年8月21日周日 18:11写道:
>
> 黄复雄 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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
___________________________________________________________________________________

  parent reply	other threads:[~2022-08-22  2:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 11:02 amano.kenji via ntg-context
2022-08-15 11:43 ` Taco Hoekwater via ntg-context
2022-08-15 12:00   ` amano.kenji via ntg-context
2022-08-15 15:39     ` Wolfgang Schuster via ntg-context
2022-08-16 11:33       ` amano.kenji via ntg-context
2022-08-16 15:05         ` Wolfgang Schuster via ntg-context
2022-08-21  8:24         ` 黄复雄 via ntg-context
2022-08-21 10:00           ` Hans Hagen via ntg-context
2022-08-21 10:10           ` Wolfgang Schuster via ntg-context
2022-08-21 16:19             ` Hans Hagen via ntg-context
2022-08-22  5:21               ` 黄复雄 via ntg-context
2022-08-22  7:16                 ` Hans Hagen via ntg-context
2022-09-03 10:44                   ` 黄复雄 via ntg-context
2022-08-22  2:09             ` 黄复雄 via ntg-context [this message]
2022-08-22  4:52             ` 黄复雄 via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHN0TNgW6muzt5XCfj0QKxCaSuBo=9VX4XgE5t43Akj59t+QMw@mail.gmail.com' \
    --to=ntg-context@ntg.nl \
    --cc=aahuaang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).