Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-09-03 Thread 黄复雄 via ntg-context
> 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
 
___
___
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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-22 Thread Hans Hagen via ntg-context

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
-
___
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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread 黄复雄 via ntg-context
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  于2022年8月22日周一 00:20写道:
>
> On 8/21/2022 12:10 PM, Wolfgang Schuster via ntg-context wrote:
> > 黄复雄 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
> 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
> ___


test-directions-006.lmtx
Description: Binary data


test-directions-005.lmtx
Description: Binary data


test-directions-008.lmtx
Description: Binary data
___
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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread 黄复雄 via ntg-context
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  于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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread 黄复雄 via ntg-context
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'

Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread Hans Hagen via ntg-context

On 8/21/2022 12:10 PM, Wolfgang Schuster via ntg-context wrote:

黄复雄 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 
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
-% in font-imp-scripts, line 145, comment a few lines
%
% orientate = function(character)
% local width  = character.width or 0
% local height = character.height or 0
% local depth  = character.depth or 0
% -- character.width   = height + depth + rightshift + 
rightshift
% character.height  = width - downshift
% character.depth   = shift
% -- character.xoffset = height + rightshift
% -- character.yoffset = - downshift
% -- character.orientation = orientation
% end

\definefontfeature
[vertical]
[vertical={%
orientation=3,%
down=.1,%
right=.1,%
ranges={%
cjkcompatibility,%
cjkcompatibilityforms,%
cjkcompatibilityideographs,%
cjkcompatibilityideographssupplement,%
cjkradicalssupplement,%
  % cjkstrokes,%
cjksymbolsandpunctuation,%
cjkunifiedideographs,%
cjkunifiedideographsextensiona,%
cjkunifiedideographsextensionb,%
cjkunifiedideographsextensionc,%
cjkunifiedideographsextensiond,%
cjkunifiedideographsextensione,%
cjkunifiedideographsextensionf,%
}%
}]

\definefont[NotoCJKvertical][NotoSanstc-Regular*default,vertical @ 24pt]
\definefont[NotoCJKverticalBold][NotoSanstc-Bold*default,vertical @ 48pt]

\definefallbackfamily [documentfont] [rm] [Noto Serif CJK SC] 
[preset=range:chinese,features={default,vertical}]
\definefallbackfamily [documentfont] [ss] [Noto Sans CJK SC]  
[preset=range:chinese,features={default,vertical}]
\definefallbackfamily [documentfont] [tt] [Noto Sans Mono CJK SC] 
[preset=range:chinese,features={default,vertical}]

\definefontfamily [documentfont] [rm] [Noto Serif]
\definefontfamily [documentfont] [ss] [Noto Sans]
\definefontfamily [documentfont] [tt] [Noto Sans Mono]

\setupbodyfont [documentfont,24pt]

\setuppapersize
 [A4,landscape,rotated,270]
 [A4,portrait]

\setuplayout[middle]

\showframe

\setuphead
  [chapter]
  [numbercolor=darkred,
   conversion=chinesenumerals]

\setuptolerance
  [verytolerant,stretch]

\setupinterlinespace
  [40pt]

\setuplayout
  [color=darkblue]

\setuppagenumbering
  [location=footer]

\defineconversionset
  [pagenumber]
  []
  [chinesenumerals]

\protected\def\stripe#1{\hbox orientation 0 yoffset 3pt{\strut #1}}

\setscript[hangul]

\starttext

% \startscript[hangul]

\chapter{通用规}

\placefigure
  [left,none]
  {汉字表}
  {\framed
 [width=4cm,
  height=2\lineheight,
  frame=off,
  backgroundcolor=darkgreen,
  foregroundcolor=white,
  background=color]
 {汉字表}}

\dorecurse{40}{%
通用规\ruby{范}{x}汉字表 \stripe{test #1}
}

% \stopscript

\stoptext
___
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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread 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



test.pdf
Description: Adobe PDF document
___
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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread Hans Hagen via ntg-context

On 8/21/2022 10:24 AM, 黄复雄 via ntg-context wrote:

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 
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
-

test-directions-005.pdf
Description: Adobe PDF document
\noheaderandfooterlines

% in font-imp-scripts, line 145, comment a few lines
%
% orientate = function(character)
% local width  = character.width or 0
% local height = character.height or 0
% local depth  = character.depth or 0
% -- character.width   = height + depth + rightshift + 
rightshift
% character.height  = width - downshift
% character.depth   = shift
% -- character.xoffset = height + rightshift
% -- character.yoffset = - downshift
% -- character.orientation = orientation
% end

\dontcomplain

\setuplayout[middle]

\starttext

\startluacode
local nuts  = nodes.nuts

local nextglyph = nuts.traversers.glyph
local nextnode  = nuts.traversers.node

local newhlist  = nuts.pool.hlist
local newglue   = nuts.pool.glue
local newpenalty= nuts.pool.penalty

local getprev   = nuts.getprev
local setnext   = nuts.setnext
local getnext   = nuts.getnext
local setprev   = nuts.setprev
local getboth   = nuts.getboth
local setboth   = nuts.setboth
local setlink   = nuts.setlink
local getlist   = nuts.getlist
local setlist   = nuts.setlist
local setwhd= nuts.setwhd
local getwhd= nuts.getwhd
local getid = nuts.getid
local getchar   = nuts.getchar

local getbox= nuts.getbox

local getdimensions = nuts.dimensions

local setorientation  = nuts.setorientation
local getorientation  = nuts.getorientation

local glyph_code= nodes.nodecodes.glyph
local kern_code = nodes.nodecodes.kern

function document.manipulate_one(boxnumber)

local box  = getbox(1000)
local list = getlist(b)
local all  = { }

for n, c, f in nextglyph, list do
if c > 200 then
all[n] = true
end
end

local o = 4 * 65536

for n, how in next, all do
local prev, next = getboth(n)
setboth(n)
local l = newhlist(n)
local w, h, d = getwhd(n)
setlink(prev,l,next)
if how then
setwhd(l,h+d+o,w,0)
setorientation(l,0x003,0,0,h,d-o)
end
if n == list then
setlist(box,l)
end
end

end

local function flushrange(head,current,first,last)
local prev = getprev(first)
local next = getnext(last)
local list = newhlist(first)
setprev(first)
setnext(last)
local w, h, d = getdimensions(first)
setwhd(list,h+d,w,0)
setlink(prev,list,next)
setorientation(list,0x001,0,0,h,d)
if first == head then
return list, list
else
return head, list
end
end

local function flushchar(head,current)
local next = getnext(current)
local glue = newglue(n,655360)
setlink(current,glue,next)
return head, glue
end

function document.manipulate_two(boxnumber)

local box = getbox(1000)
local head= getlist(box)
local first   = false
local last= false
local current = head
while current do
local id = getid(current)
if id == glyph_code then
if getchar(current) < 200 then
if first then
last = current
else
first = current
  

Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-21 Thread 黄复雄 via ntg-context
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  于2022年8月16日周二 19:34写道:
>
> 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
> > x \ruby{aaa}{bbb} x
> > \stop
> >
> > \start \setupruby[location=left]
> > \type{\setupruby[location=left]}\quad x \ruby{aaa}{bbb} x
> > \stop
> >
> > \start \setupruby[location=right]
> > \type{\setupruby[location=right]}\quad x \ruby{aaa}{bbb} x
> > \stop
> >
> > \start \setupruby[location=right,left={[},right={]}]
> > \type{\setupruby[left={[},right={]}]}\quad x \ruby{aaa}{bbb}
> > x
> > \stop
> >
> > \start \setupruby[align=flushleft]
> > \type{\setupruby[align=flushleft]}\quad x \ruby{aa}{bbb}
> > x
> > \stop
> >
> > \start \setupruby[align=flushright]
> > \type{\setupruby[align=flushright]}\quad x \ruby{aa}{bbb}
> > x
> > \stop
> >
> > \start \setupruby[style=\itxx]
> > \type{\setupruby[style=\itxx]}\quad x \ruby{aaa}{bbb} x
> > \stop
> >
> > \start \setupruby[color=blue]
> > \type{\setupruby[color=blue]}\quad x \ruby{aaa}{bbb} x
> > \stop
> >
> > \start \setupruby[voffset=-1.2ex]
> > \type{\setupruby[voffset=-1.2ex]}\quad x \ruby{aaa}{bbb} x
> > \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
> ___
___
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 : 

Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-16 Thread Wolfgang Schuster via ntg-context

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

___
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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-16 Thread 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
> x \ruby{aaa}{bbb} x
> \stop
>
> \start \setupruby[location=left]
> \type{\setupruby[location=left]}\quad x \ruby{aaa}{bbb} x
> \stop
>
> \start \setupruby[location=right]
> \type{\setupruby[location=right]}\quad x \ruby{aaa}{bbb} x
> \stop
>
> \start \setupruby[location=right,left={[},right={]}]
> \type{\setupruby[left={[},right={]}]}\quad x \ruby{aaa}{bbb}
> x
> \stop
>
> \start \setupruby[align=flushleft]
> \type{\setupruby[align=flushleft]}\quad x \ruby{aa}{bbb}
> x
> \stop
>
> \start \setupruby[align=flushright]
> \type{\setupruby[align=flushright]}\quad x \ruby{aa}{bbb}
> x
> \stop
>
> \start \setupruby[style=\itxx]
> \type{\setupruby[style=\itxx]}\quad x \ruby{aaa}{bbb} x
> \stop
>
> \start \setupruby[color=blue]
> \type{\setupruby[color=blue]}\quad x \ruby{aaa}{bbb} x
> \stop
>
> \start \setupruby[voffset=-1.2ex]
> \type{\setupruby[voffset=-1.2ex]}\quad x \ruby{aaa}{bbb} x
> \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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-15 Thread 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
x \ruby{aaa}{bbb} x
\stop

\start \setupruby[location=left]
\type{\setupruby[location=left]}\quad x \ruby{aaa}{bbb} x
\stop

\start \setupruby[location=right]
\type{\setupruby[location=right]}\quad x \ruby{aaa}{bbb} x
\stop

\start \setupruby[location=right,left={[},right={]}]
\type{\setupruby[left={[},right={]}]}\quad x \ruby{aaa}{bbb} 
x

\stop

\start \setupruby[align=flushleft]
\type{\setupruby[align=flushleft]}\quad x \ruby{aa}{bbb} 
x

\stop

\start \setupruby[align=flushright]
\type{\setupruby[align=flushright]}\quad x \ruby{aa}{bbb} 
x

\stop

\start \setupruby[style=\itxx]
\type{\setupruby[style=\itxx]}\quad x \ruby{aaa}{bbb} x
\stop

\start \setupruby[color=blue]
\type{\setupruby[color=blue]}\quad x \ruby{aaa}{bbb} x
\stop

\start \setupruby[voffset=-1.2ex]
\type{\setupruby[voffset=-1.2ex]}\quad x \ruby{aaa}{bbb} x
\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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-15 Thread amano.kenji via ntg-context
Is there any documentation about \ruby? What about vertical text?

--- Original Message ---
On Monday, August 15th, 2022 at 11:43 AM, Taco Hoekwater  
wrote:


> > 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: t...@bittext.nl
> genderfluid (all pronouns)
>
___
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
___


Re: [NTG-context] Is rendering furigana over horizontal or vertical japanese text doable in ConTeXt?

2022-08-15 Thread Taco Hoekwater via ntg-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: t...@bittext.nl
genderfluid (all pronouns)



___
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
___