ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Subject: Re: Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?
Date: Sun, 21 Aug 2022 12:10:03 +0200	[thread overview]
Message-ID: <011c9bde-bc0c-b15f-53a5-a51d4b8f3728@gmail.com> (raw)
In-Reply-To: <CAHN0TNiaPxCA53_c7Hee-kB=f0kfKvJ0B-+CXgGMyo=JoetB+A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1749 bytes --]

黄复雄 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


[-- Attachment #2: test.pdf --]
[-- Type: application/pdf, Size: 16822 bytes --]

[-- Attachment #3: Type: text/plain, Size: 496 bytes --]

___________________________________________________________________________________
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-21 10:10 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 [this message]
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
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=011c9bde-bc0c-b15f-53a5-a51d4b8f3728@gmail.com \
    --to=ntg-context@ntg.nl \
    --cc=wolfgang.schuster.lists@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).