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'
...n64/tex/texmf-context/te

[NTG-context] How to reset settings in setuphead back to defaults?

2022-08-21 Thread Joel via ntg-context
I have some settings like this, which define the part, chapter, and section 
titles within a file that contains all of my common settings for all files.

\definepagebreak[chapterpagebreak][yes, right]

\setuphead[part][style=\sse, placehead=yes, expansion=yes]
\setuphead[chapter][style=\sse, placehead=yes, expansion=yes, page=yes,
                        numbercommand=\groupedcommand{}{\blank[1cm]},
                        alternative=middle,
                        numberstyle=ssl,
                        numbercolor=white,
                        strut=yes,
                        page=chapterpagebreak,
                        header=empty]
\setuphead[subject][style=\sse, placehead=yes, expansion=yes, page=yes,
                        numbercommand=\groupedcommand{}{\blank[1cm]},
                        alternative=middle,
                        numberstyle=ssl,
                        numbercolor=white,
                        strut=yes,
                        page=chapterpagebreak,
                        header=empty]
A problem I have is I need one document to ignore all the above, basically 
pretend each of these is reset to defaults. Is there a way to rest all of the 
above items to default settings quickly?
--Joel
___
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] How can I make a Gentoo Linux package for ConTeXt LMTX?

2022-08-21 Thread Michal Vlasák via ntg-context
On Mon Aug 15, 2022 at 2:03 PM CEST, amano.kenji via ntg-context wrote:
> TexLive has texmfcnf.lua that doesn't really work with texlive-context 
> installed by linux distributions.
>
> Arch Linux has its own patched version of texmfcnf.lua.
>
> It seems I'd be better off with a linux package for ConTeXt LMTX.
>
> How can I build and install ConTeXt LMTX on Gentoo Linux or any linux 
> distribution?
>
> I wish it was as simple as ./configure, make, and make install.

Some of the problems were mentioned in previous discussions. Like:

 - you would need to maintain your own "snapshots" of the current
   ConTeXt (or make use of the public git mirror)
 - you currently can't build luametatex binary from source, you would
   have to download it prebuilt (and also keep snapshots of it)
 - different directory structure expected by Linux distributions (FHS,
   "file hierarchy standard") vs TeX (TDS, "TeX directory structure")

In addition, there are still many uncertain things, like how you want to
handle fonts:

 - install some with ConTeXt? (In that case you might distribute fonts
   already available in your Linux distribution)
 - use system ones? (Then your documents may be subject to breakages
   from uncoordinated updates - ConTeXt has goodie files tuned to
   particular versions of fonts)

Also, AFAIK, packages are diligent with keeping license information and
documentation, you would have to decide how that information would be
kept (this is mostly the directory structure problem).

With that said, taking Hans' instructions as a start:

On Fri Aug 19, 2022 at 3:11 PM CEST, Hans Hagen via ntg-context wrote:
> Not sure what you mean here but basically a (future) installation is:
>
> - unzip the main zip file
> - goto the source subtree
> - run build.sh (assumes compiler and cmake installed)
> - move the binary file to the relevant bin location
> - set symlinks from luametatex to mtsrun and context
> - copy mtxrun.lua and context.lue there too
> - adapt your path
> - maybe add texmf-fonts and texmf-projects
> - and you're done

You need two things from ConTeXt: texmf directories (there are two
provided by ConTeXt "texmf-context" - what you really need, "texmf" -
mostly fonts) and the luametatex binary.

For simplicity let's only include "texmf-context":

In that case you need to extract "mtxrun" (rename to "luametatex") from
http://lmtx.pragma-ade.nl/install-lmtx/context-linux-64.zip and download
the "texmf-context" texmf tree from
http://lmtx.pragma-ade.nl/install-lmtx/texmf-context.zip.

This is how you get luametatex to execute script like mtxrun or context:

 - luametatex binary gets executed with name (argv[0]) 

Re: [NTG-context] Clipping multiple PDFs

2022-08-21 Thread Pablo Rodriguez via ntg-context
On 8/18/22 02:13, jethro Reuel via ntg-context wrote:
> Hello,
>
> I am trying to put multiple PDF’s that were typeset differently into
> one document without modifying the individual files themselves.
> [...]
> The problem is the original page numbers show and I’d prefer that it
> did not. So I thought maybe I could clip all the page numbers from
> every page (since they are all in the same position across all the
> pages) but I don’t know how to do this with the \clip command. Any
> ideas? I already tried using \input but it gives some weird output in
> some places. It doesn’t have to use this method as long as it does
> what I need it to do.

Hi Jethro,

it works using \clip with \externalfigure inside a loop (\dorecurse).

With \getfiguredimensions you get the number of pages of each PDF
document (\noffigurepages).

The following source both generates the source PDF document and the
imposed result with clipped pages (just to see a sample of the commands
mentioned above):

  \startbuffer[newbuff]
  \setuppapersize[A3]
  \setupbodyfont[sans, 1200pt]
  \starttext
  \dorecurse{8}
  {\startmakeup[page][pagestate=start, align=center, style=\bf]
\recurselevel
   \stopmakeup}
  \stoptext
  \stopbuffer
  \startmode[*first]
  \savebuffer[newbuff][source_page.tex, prefix=no]
  \executesystemcommand{context --purgeall source_page.tex}
  \stopmode
  \setuplayout[page]
  \setuppapersize[A6][A4]
  \setuppaper[nx=2, ny=2]
  \setuparranging [XY]
  \starttext
  \startnotmode[*first]
  \def\Doc{source_page.pdf}
  \getfiguredimensions[\Doc]
  \dorecurse{\noffigurepages}
{\clip[hoffset=96mm, voffset=136mm, width=105mm, height=148mm]
{\externalfigure[\Doc][page=\recurselevel]}}
  \stopnotmode
  \stoptext

Just in case it might help,

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


[NTG-context] ConTeXt Workshop at FrOSCon

2022-08-21 Thread juh via ntg-context
Dear all,

my workshop is over and it was quite nice. There were five people that
attended the whole workshop and two that looked into it and left after
some minutes.

I had their attention from the beginning, after I showed them the flyers
I made for my cooperative.
https://www.hasecke.eu/post/werbemittel-mit-context-gestalten/
I guess that this is what people expect from ConTeXt: individually
styled products. 

The workshop was two hours long so that I could only show the very first
steps. One interesting thing is that one person never worked with TeX
or LaTeX before. The others had experience with LaTeX of course. Is this an
indication that ConTeXt can attract people that never worked with TeX
before?

There is one thing that is quite error prone for beginners, a small detail
during the installation process. 

Everyone worked on Linux and was able to use the command line but
nonetheless two of five had problems to correctly set the PATH variable.

So I have one question.
Is it possible or reasonable to extend the install script so that it
adds the new path directly to .bashrc? Or at least to ask the user if
the script should do this? 

Now we have to do theses steps:

sh .install.sh
copy the line with the path
vim .bashrc
insert the line, save and exit vim
source .bashrc

I can think of arguments against the idea of an installation script that
set the variable automatically.  One thing is that not everyone uses
bash, many use zsh. As I use both shells I set many environment
variables in a custom file called .exportrc. So for me personally the
extension of the script would be of no advantage. But maybe it can 
ease the way of beginners.

Thanks a lot to Hraban and to Joaquín. The "introduction" and Hrabans
manuscript helped me to outline the things I wanted to show.

juh
-- 
Autoren-Homepage: . http://literatur.hasecke.com
Satiren & Essays: . http://www.sudelbuch.de
Privater Blog:  http://www.hasecke.eu
Netzliteratur-Projekt:  http://www.generationenprojekt.de




signature.asc
Description: PGP signature
___
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 : https://c

Re: [NTG-context] Repeating binary operators with split multiline formulas

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

On 8/21/2022 1:04 AM, Adam Reviczky via ntg-context wrote:


Since there has been a lot of work done on the math side of things, I
wanted to ask if there is an automated way to have binary operators
repeated when splitting a formula.

 From the MKIV math manual there is an option to move the operators into the
new line:

\setupmathematics[setups=math:spacing:split]
\setupformulas[split=yes,align=flushleft]
\startformula
x\dorecurse{30}{ + #1x^{#1x}} = 10
\stopformula

Would it be possible to achieve this via a custom setup like
math:spacing:split to get an output like this?

𝑥 + 1𝑥1𝑥 + 2𝑥2𝑥 + 3𝑥3𝑥 + 4𝑥4𝑥 + 5𝑥5𝑥 + 6𝑥6𝑥 + 7𝑥7𝑥 + 8𝑥8𝑥 +
9𝑥9𝑥 + 10𝑥10𝑥 +
+ 11𝑥11𝑥 + 12𝑥12𝑥 + 13𝑥13𝑥 + 14𝑥14𝑥 + 15𝑥15𝑥 + 16𝑥16𝑥 + 17𝑥17𝑥 +
18𝑥18𝑥 + 19𝑥19𝑥 +
+ 20𝑥20𝑥 + 21𝑥21𝑥 + 22𝑥22𝑥 + 23𝑥23𝑥 + 24𝑥24𝑥 + 25𝑥25𝑥 + 26𝑥26𝑥 +
27𝑥27𝑥 + 28𝑥28𝑥 +
+ 29𝑥29𝑥 + 30𝑥30𝑥 = 10
What you are basically asking for is "math discretionaries that don't 
interfere with spacing and penalties as assigned in math processing" .


I attached what we have done so far. Regular discretionaries are already 
supported but recently - not yet in the upload - and last week I added 
support for specific math discretionaries to the engine (no need to 
switch to math in a dicretionary so no style guesswork needed) and then 
also a more native handling of characters directly (using \\hmcode's) so 
no need for some command that injects the discretionary.


We have no high level interface yes so if you have suggestions on how 
this is to be used (what binaries for instance, is it language 
dependent) let us know.


Mikael and I still need to look into more granular inter-atom penalties 
(there is quite some control possible but it is simply not yet used).


There will probably be an upload one of these days (all build engines 
need to be up and running) btu we're first wrapping up some other (cool) 
mechanism.


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
-

ontarget-mathcharacters.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
___