[NTG-context] Re: Japanese

2024-03-14 Thread Emanuel Han via ntg-context
Dear Otared,

when you read the lua code in the first \directlua{}, you should realize that 
the dimensions of almost all layout elements are depending on the value of my 
lua variable "paperSize".
Thanks to defining the paper size first in lua, I can apply calculations of 
numeric values.

The value of paperSize is later passed on to \setuppapersize via 
\setuppapersize[\directlua{tex.print(paperSize)}]
Emanuel
On März 13 2024, at 3:55 pm, Otared Kavian  wrote:
> Hi Emmanuel,
>
> Thank you so much for the new setup for writing Japanese: I tested with both 
> files, and noticed that with the new version the output looks great.
> I have a question about the code in the \directlua{} part of your setup: why, 
> for instance, the
> paperSize = « B5"
> is defined « by hand » there, instead of being retrieved from the command
> \setuppapersize[B5]
> issued by the user?
>
> Actually I am using your setup for learning Japanese, and at my beginner’s 
> level I do separate words I am learning with spaces. While with the previous 
> version of your setup the lines were breaking womewhat strangely, but now the 
> spaces between words in the output are as I intended them to be (I should 
> also Thank Wolfgang Schuster for his insight with the \script[nihongo], and 
> indeed Hans for fixing so quickly the slightest bug).
> It is really a great pleasure to be in this community where help comes from 
> everyone and features are given on demand !
> Best regards: Otared
> > On 10 Mar 2024, at 17:43, Emanuel Han via ntg-context  
> > wrote:
> >
> > Hi all,
> >
> > I added 
> > https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X_4051_Requirements_for_Japanese_Text_Layout
> > with attached working example code and to-do list.
> >
> > Thanks for any contributions!
> >
> > The working example code is still a work in progress. Its text layout 
> > output meets already some of the requirements (see comments in the code). 
> > Among the ones to still be implemented are:
> >
> > • solid setting (no extra spacing between characters) 
> > https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment 
> > https://www.w3.org/TR/jlreq/#term.line-adjustment
> > • aligning of the lines to the Kihon-hanmen (optimizing the code below in 
> > this regard)
> > • positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 
> > https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and 
> > https://www.w3.org/TR/jlreq/#fig3_1_4
> > • positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24
> > • inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1
> > • emphasis with sesame dot or bullet
> > • itemization https://www.w3.org/TR/jlreq/#fig2_5_6
> > • indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7
> > • tab setting https://www.w3.org/TR/jlreq/#fig2_6_1
> > • furiwake https://www.w3.org/TR/jlreq/#fig2_7_2
> > • jidori https://www.w3.org/TR/jlreq/#fig2_7_4
> > • math https://www.w3.org/TR/jlreq/#fig2_7_6 and 
> > https://www.w3.org/TR/jlreq/#fig2_7_62
> > • tategaki (writing vertically)
> > Best regards
> >
> > Emanuel
> > On März 2 2024, at 7:00 pm, Wolfgang Schuster 
> >  wrote:
> > Emanuel Han schrieb am 01.03.2024 um 16:23:
> >
> > Dear Wolfgang,
> >
> > thank you for your valuable remarks. I integrated them, see corrected 
> > attached example.
> >
> > Yes, correct layout examples exist. They're all showing vertical writing, 
> > but the rules and principles are exactly the same for horizontal writing.
> >
> > • position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
> >
> > See my attached gongitsune.tex example how you can squeeze text in a very 
> > narrow header/footer.
> >
> > • aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
> >
> > You can use the lines key for \setuplayout to let ConTeXt calculate the 
> > necessary value for the text height.
> >
> > • protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
> >
> > You're getting this for free because ruby text doesn't take up vertical 
> > space, in case vertical text is working it would now stick into the margins 
> > as expected.
> >
> > \starttext
> > \ruledhbox{a \ruby{x}{y} b}
> > \stoptext
> >
> >
> >
> > In my previous mail, I wrote wrong amounts of lines. They should be 46 
> > lines on one page, while the actual example doesn't show the 46th line.
> >
> > It would be important to identify the reason why only 24 characte

[NTG-context] Re: update

2024-03-11 Thread Emanuel Han via ntg-context
Dear developers,
thanks for your hard work!

Thank you Wolfgang for the Japanese line break rule fix in line 831 of 
scrp-cjk.lua:
full_width_open = stretch_break, -- WS, was: nobreak_stretch_break_shrink,

Emanuel

On März 11 2024, at 7:23 pm, Pablo Rodriguez via ntg-context 
 wrote:
> On 3/11/24 18:48, Hans Hagen wrote:
> > Hi,
> >
> > Todays update has a fix for the compact mode slant interference (as
> > explained by Wolfgang a few days ago). Hopefully that works out well.
>
> Many thanks for that fix, Hans.
> Pablo
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Japanese

2024-03-10 Thread Emanuel Han via ntg-context
Hi all,

I added 
https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X_4051_Requirements_for_Japanese_Text_Layout
with attached working example code and to-do list.
Thanks for any contributions!
The working example code is still a work in progress. Its text layout output 
meets already some of the requirements (see comments in the code). Among the 
ones to still be implemented are:
solid setting (no extra spacing between characters) 
https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment 
https://www.w3.org/TR/jlreq/#term.line-adjustment
aligning of the lines to the Kihon-hanmen (optimizing the code below in this 
regard)

positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 
https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and 
https://www.w3.org/TR/jlreq/#fig3_1_4

positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24

inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1

emphasis with sesame dot or bullet

itemization https://www.w3.org/TR/jlreq/#fig2_5_6

indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7

tab setting https://www.w3.org/TR/jlreq/#fig2_6_1

furiwake https://www.w3.org/TR/jlreq/#fig2_7_2

jidori https://www.w3.org/TR/jlreq/#fig2_7_4

math https://www.w3.org/TR/jlreq/#fig2_7_6 and 
https://www.w3.org/TR/jlreq/#fig2_7_62

tategaki (writing vertically)

Best regards

Emanuel
On März 2 2024, at 7:00 pm, Wolfgang Schuster 
 wrote:
> Emanuel Han schrieb am 01.03.2024 um 16:23:
> >
> > Dear Wolfgang,
> > thank you for your valuable remarks. I integrated them, see corrected 
> > attached example.
> > Yes, correct layout examples exist. They're all showing vertical writing, 
> > but the rules and principles are exactly the same for horizontal writing.
> > position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
> See my attached gongitsune.tex example how you can squeeze text in a very 
> narrow header/footer.
> > aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
> You can use the lines key for \setuplayout to let ConTeXt calculate the 
> necessary value for the text height.
> > protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
> You're getting this for free because ruby text doesn't take up vertical 
> space, in case vertical text is working it would now stick into the margins 
> as expected.
> \starttext
> \ruledhbox{a \ruby{x}{y} b}
> \stoptext
>
>
> >
> > In my previous mail, I wrote wrong amounts of lines. They should be 46 
> > lines on one page, while the actual example doesn't show the 46th line.
> > It would be important to identify the reason why only 24 characters are 
> > used to create a line when 25 could be used. Then we can develop a method 
> > to turn that mechanism off or circumvent it.
> > Quotation from https://www.w3.org/TR/jlreq:
> > In principle, when composing a line with ideographic (cl-19) 
> > (https://www.w3.org/TR/jlreq/#cl-19), hiragana (cl-15) 
> > (https://www.w3.org/TR/jlreq/#cl-15) and katakana (cl-16) 
> > (https://www.w3.org/TR/jlreq/#cl-16) characters, no extra spacing appears 
> > between their character frame 
> > (https://www.w3.org/TR/jlreq/#term.character-frame). This is called solid 
> > setting (see Figure 5 (https://www.w3.org/TR/jlreq/#fig1_8)).
>
>
> 1. ConTeXt has a mechanism to typeset Japanese texts.
> 2. There are flaws in the output it produces but this nothing which can't be 
> fixed.
> 3. To fix the problems someone has to be passionate to fix them and we're 
> willing to help here.
> As you can see in my second example file japanese.tex there is a font feature 
> to create half sized parentheses etc. which isn't supported yet by ConTeXt's 
> mechanism for japanese and in case your willing to improve it this should be 
> taken care of as well.
> Wolfgang

japanese_mwe.tex
Description: TeX document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Japanese

2024-03-01 Thread Emanuel Han via ntg-context
Dear Wolfgang,

thank you for your valuable remarks. I integrated them, see corrected attached 
example.
Yes, correct layout examples exist. They're all showing vertical writing, but 
the rules and principles are exactly the same for horizontal writing.
position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on 
one page, while the actual example doesn't show the 46th line.
It would be important to identify the reason why only 24 characters are used to 
create a line when 25 could be used. Then we can develop a method to turn that 
mechanism off or circumvent it.
Quotation from https://www.w3.org/TR/jlreq:
In principle, when composing a line with ideographic (cl-19) 
(https://www.w3.org/TR/jlreq/#cl-19), hiragana (cl-15) 
(https://www.w3.org/TR/jlreq/#cl-15) and katakana (cl-16) 
(https://www.w3.org/TR/jlreq/#cl-16) characters, no extra spacing appears 
between their character frame 
(https://www.w3.org/TR/jlreq/#term.character-frame). This is called solid 
setting (see Figure 5 (https://www.w3.org/TR/jlreq/#fig1_8)).

I made manual corrections to scrp-cjk.lua, but with no effect to the ConTeXt 
output of my example. Do I have to recompile ConTeXt first?
Emanuel
On März 1 2024, at 2:59 pm, Wolfgang Schuster 
 wrote:
> Emanuel Han via ntg-context schrieb am 01.03.2024 um 13:08:
> > Dear all, thanks for your contributions.
> >
> > Sure I'll update the
> > https://wiki.contextgarden.net/Chinese_Japanese_and_Korean hopefully
> > with the help of Jeong Dal and others as soon as things are sorted out.
> >
> > In attached example, the opening Brackets (I marked them with
> > \color[red]{【} and \color[red]{{}) are taking the previous character
> > with them to the next line. Please remove these to see that the
> > previous character would stay on the previous line. Thanks Wolfgang
> > for checking wether this is a bug.
>
> Can you stick to fonts which are available for all systems (e.g. Noto
> CJK) because system fonts are a pain when you're on a different system.
>
> The missing line break before 【 is caused by a wrong table entry in
> scrp-cjk.lua and I guess the following change is necessary
>
> local japanese_2 = {
> jamo_initial = korean_break,
> korean = stretch_break,
> chinese = stretch_break,
> hiragana = stretch_break,
> katakana = stretch_break,
> half_width_open = nobreak_stretch_break_autoshrink,
> half_width_close = nobreak_stretch,
> - full_width_open = nobreak_stretch_break_shrink,
> + full_width_open = stretch_break,
> full_width_close = nobreak_stretch,
> full_width_punct = japanese_before_full_width_punct, --
> nobreak_stretch,
> hyphen = nobreak_stretch,
> non_starter = nobreak_stretch,
> other = stretch_break,
> }
>
> but there can be more wrong entries.
> > I was not successful in figuring out how the protrusion mechanism can
> > be set in order to keep full stops and commas on the previous line
> > (protruding the column box). Could you please give me a hint,
> > Wolfgang? Thanks. There's a \color[red]{。} in my example which should
> > not jump to the next line.
>
> Adding the first and last line to your example document worked for me.
> \definefontfeature [default] [default] [protrusion=pure]
> \definefontfamily [...] [...] [...]
> \setupbodyfont [...]
> \setupalign [hanging]
> > My example follows the Kihon-hanmen dimensioning as described in
> > https://www.w3.org/TR/jlreq . What could be the reason that lines
> > which could hold 25 characters are having only 24 characters, for
> > example lines 2, 3 or 13 in column 1? I would expect them to have 25
> > characters, the same as for example lines 7, 9 or 16 in column 1.
>
> I guess the par builder is responsible for this when it arranges the
> paragraph but this is just a guess.
>
> > How can I change alignment of the lines so that the highest character
> > boxes align with the top border of the layout boxes for text and
> > header and with the bottom border of the layout box for footer? I hope
> > that when this is achieved for the layout box for text, then this box
> > would hold the expected 45 lines, and not 44 lines as it is doing now.
> > Ruby characters in the first line should protrude the box, what they
> > already do.
> > I tried to implement the 1em hskip of the header and footer away from
> > the page border. While it works for left aligned headers and footers,
> > it doesn't for the right aligned headers and footers (negative hskip
> > has no effect). How to solve this problem?
>
> Do you a proper exampl

[NTG-context] Re: Japanese

2024-03-01 Thread Emanuel Han via ntg-context
Dear all, thanks for your contributions.

Sure I'll update the https://wiki.contextgarden.net/Chinese_Japanese_and_Korean 
hopefully with the help of Jeong Dal and others as soon as things are sorted 
out.
In attached example, the opening Brackets (I marked them with \color[red]{【} 
and \color[red]{{}) are taking the previous character with them to the next 
line. Please remove these to see that the previous character would stay on the 
previous line. Thanks Wolfgang for checking wether this is a bug.
I was not successful in figuring out how the protrusion mechanism can be set in 
order to keep full stops and commas on the previous line (protruding the column 
box). Could you please give me a hint, Wolfgang? Thanks. There's a 
\color[red]{。} in my example which should not jump to the next line.
My example follows the Kihon-hanmen dimensioning as described in 
https://www.w3.org/TR/jlreq . What could be the reason that lines which could 
hold 25 characters are having only 24 characters, for example lines 2, 3 or 13 
in column 1? I would expect them to have 25 characters, the same as for example 
lines 7, 9 or 16 in column 1.
How can I change alignment of the lines so that the highest character boxes 
align with the top border of the layout boxes for text and header and with the 
bottom border of the layout box for footer? I hope that when this is achieved 
for the layout box for text, then this box would hold the expected 45 lines, 
and not 44 lines as it is doing now. Ruby characters in the first line should 
protrude the box, what they already do.
I tried to implement the 1em hskip of the header and footer away from the page 
border. While it works for left aligned headers and footers, it doesn't for the 
right aligned headers and footers (negative hskip has no effect). How to solve 
this problem?
Also how to get rid of the first empty page?
I'm happy to get suggestions for improving my example code. This example could 
then be put to the wiki.
I try to continue to work on making ConTeXt usable for Japanese with the help 
of you all. Next step might be the realm and position of headings which seem 
complicated and for which I have no ideas.
Best regards
Emanuel

On März 1 2024, at 8:04 am, luigi scarso  wrote:
>
>
> On Wed, 28 Feb 2024 at 20:53, Emanuel Han via ntg-context  (mailto:ntg-context@ntg.nl)> wrote:
> > Thank you all for your suggestions and contributions to the wiki.
> >
> > I don't intend to nag, but when looking at what ConTeXt is producing, I 
> > need to state that the result is still far away from a properly typeset 
> > Japanese text.
> > So the nihongo script which comes with ConTeXt handles line breaks / line 
> > wrapping. But the line break rules defined in it need a rework, because 
> > they don't follow the standards. The standards are documented here: 
> > https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characters
> >  , and all affected characters are listed here: 
> > https://www.w3.org/TR/jlreq/tables/table_en3.pdf
> > We have different rules, depending what kind of character is surpassing the 
> > text width (or is in its last position).
> > Rule 1:
> > Before closing brackets, closing quotation marks, iteration marks, the 
> > Prolonged sound mark and small Kana, line breaking is prohibited.
> > ’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc.
> > The actual programmed behaviour by the nihongo script is that, if in the 
> > position which exceeds the line width, these characters jump to the next 
> > line and take the previous character with them. If they're in the last 
> > position of the line, they stay where they are. This behaviour is correct.
> > Rule 2:
> > After opening Brackets and opening quotation marks, line breaking is 
> > prohibited (but not before).
> > ‘“(〔[{〈《「『【
> > The actual programmed behaviour by the nihongo script is that these 
> > characters jump to the next line and take the previous character with them. 
> > This behaviour is wrong. They should jump to the next line without taking 
> > the previous character with them, just like any regular character. The 
> > difference to a regular character is that they jump already when still 
> > within the line length, and they're in the last position of the line. The 
> > correct behaviour can be seen in LibreOffice Writer in action.
> > Rule 3:
> > Comma (tōten), full width comma, full stop
> > 、,。
> > The actual programmed behaviour by the nihongo script is that, if in the 
> > position which exceeds the line width, these characters jump to the next 
> > line and take the previous character with them. This behaviour is wrong.
> > They have to be put back to the end of the previous line, but beyond the 
> > specified line length. (JIS Z 8125) (Sear

[NTG-context] Re: Japanese

2024-02-28 Thread Emanuel Han via ntg-context
Thank you all for your suggestions and contributions to the wiki.

I don't intend to nag, but when looking at what ConTeXt is producing, I need to 
state that the result is still far away from a properly typeset Japanese text.
So the nihongo script which comes with ConTeXt handles line breaks / line 
wrapping. But the line break rules defined in it need a rework, because they 
don't follow the standards. The standards are documented here: 
https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characters 
, and all affected characters are listed here: 
https://www.w3.org/TR/jlreq/tables/table_en3.pdf
We have different rules, depending what kind of character is surpassing the 
text width (or is in its last position).
Rule 1:
Before closing brackets, closing quotation marks, iteration marks, the 
Prolonged sound mark and small Kana, line breaking is prohibited.
’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc.
The actual programmed behaviour by the nihongo script is that, if in the 
position which exceeds the line width, these characters jump to the next line 
and take the previous character with them. If they're in the last position of 
the line, they stay where they are. This behaviour is correct.
Rule 2:
After opening Brackets and opening quotation marks, line breaking is prohibited 
(but not before).
‘“(〔[{〈《「『【
The actual programmed behaviour by the nihongo script is that these characters 
jump to the next line and take the previous character with them. This behaviour 
is wrong. They should jump to the next line without taking the previous 
character with them, just like any regular character. The difference to a 
regular character is that they jump already when still within the line length, 
and they're in the last position of the line. The correct behaviour can be seen 
in LibreOffice Writer in action.
Rule 3:
Comma (tōten), full width comma, full stop
、,。
The actual programmed behaviour by the nihongo script is that, if in the 
position which exceeds the line width, these characters jump to the next line 
and take the previous character with them. This behaviour is wrong.
They have to be put back to the end of the previous line, but beyond the 
specified line length. (JIS Z 8125) (Search for "Line adjustment by hanging 
punctuation" under https://www.w3.org/TR/jlreq/ )
If they're in the last position of the line, they stay where they are. The 
correct behaviour can be seen in LibreOffice Writer in action.

Rules 4, 5, ...:
Combinations of inseparable characters... (see 
https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_character ) 
and eventually more, which I didn't test.
It might be useful to define three scripts nihongo_loose, nihongo_strict and 
nihongo_very_strict which each implement one of the 3 cases described here: 
https://www.w3.org/TR/jlreq/#addendum_a
According the line gap (Otared uses \setupwhitespace[big], which is exceeding 
common line gaps), I'd like to quote from https://www.w3.org/TR/jlreq/ :
It is common that the line gap for the kihon-hanmen is set to a value between 
half-em spacing and the one em spacing of the character frame used for the 
kihon-hanmen. Half-em spacing can be chosen in cases where the line length is 
short, but one em spacing or close to it is more appropriate when the line 
length is longer than 35 characters.
I like the standard line gap which is provided by ConTeXt, which is equivalent 
to \setupwhitespace[0pt]. Even when using ruby, it works well. I found the best 
voffset for ruby to be -1.7ex.
The line adjustment provided by ConTeXt by default is not meeting the needs for 
Japanese (and Chinese) text, which follow a grid pattern. Especially the last 
line of a paragraph is squeezed, which is "hurting the eye".
When characters need to jump to the next line due to previously discussed line 
breaking rules, ConTeXt seems to apply "Line adjustment by inter-character 
spacing expansion", which is a valid method according to 
https://www.w3.org/TR/jlreq/#line_adjustment , although "Line adjustment by 
inter-character spacing reduction" is preferred.
The last point which ConTeXt is missing, when talking about Japanese 
typesetting, is vertical writing.
I know, this is a lot of work. Hopefully we can achieve with joint efforts to 
make ConTeXt Japanese ready.
If I happen to have made false statements, please accept my apology. I tried to 
be of help as far as I could. I grew up in Japan and know more or less how 
typeset text should look like.
Emanuel
On Feb. 28 2024, at 7:44 pm, Jean-Pierre Delange  wrote:
> Hi Hraban !
>
> I also used to write this, if the main language is European :
> \definefallbackfamily [mainface] [rm] [ipamincho]
> [range=cjkunifiedideographs]
>
> Hope this is useful anymore,
> JP
> Le 28/02/2024 à 18:34, Henning Hraban Ramm a écrit :
> > Am 28.02.24 um 08:34 schrieb Otared Kavian:
> >> Dear Dalyoung,
> >>
> >> Thank you very much for your insight. I downloaded the Noto Serif JP
> >> fonts and set up a fontfamily 

[NTG-context] Re: Japanese

2024-02-26 Thread Emanuel Han via ntg-context
Unfortunately vertical typesetting is not supported by ConTeXt. That's a big 
pity.

If horizontal typesetting is fine, this little working example with furigana 
might give you some hints. Hiragino Mincho Pro should be installed by Default 
on MacOS.
\enableregime[utf] % enable unicoded input
\definefontfamily [JapaneseFont] [rm] [hiraginominchopro]

\setupruby[location=top,voffset=-1.6ex, ]
\starttext \JapaneseFont
\ruby{僕}{ぼく}はもう\ruby{寝}{ね}る。
お\ruby{休}{やす}みなさい^_^
\stoptext

On Feb. 26 2024, at 9:08 pm, Otared Kavian  wrote:
> Hi all,
>
> Does anyone have a simple setup of fonts to write a small Japanese document 
> (possibly with furagana) ? I am using MacOS and I have several Japanese fonts 
> on the system.
> I have some old examples which do not typeset correctly now, maybe because 
> they use the old module simplefonts and commands such as \setcjkmainfont and 
> friends.
>
> Many thanks in advance: Otared
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
Thanks Mikael. This helped indeed.
I updated my example on the Metapost page in the wiki accordingly.

The`pagestate=start` functionality is not documented in the wiki. It's not 
clear for which context commands it can or should be used. Who is willing to 
help out here?
Best regards
Emanuel
On Feb. 19 2024, at 2:39 pm, Mikael Sundqvist  wrote:
> Hi,
>
> Try
> \startTEXpage[pagestate=start]
> /Mikael
> On Mon, Feb 19, 2024 at 2:31 PM Emanuel Han via ntg-context
>  wrote:
> >
> >  I just made a strange observation in the output pdf of the attached 
> > layer_set.tex, which is that when opening it with a pdf viewer like skim or 
> > macos preview and showing miniatures, all pages except the last one show 
> > page number 1 (the last showing page number 2).
> >
> > Which was not the case with the output pdf of the attached 
> > multipage_metapost_mwe-very_simple.tex.
> >
> > How can I change my code to have proper consecutive page numbering in a pdf 
> > viewer?
> >
> > On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context 
> >  wrote:
> >
> > I think I could solve all the problems. Attached the finalized working 
> > example. I created the 
> > https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages 
> > entry with it. Feel free to modify.
> >
> > Cheers
> > Emanuel
> >
> > On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> >
> > Hi,
> >
> > not sure I get what you are missing. But you can try
> >
> > setbounds currentpicture to (fullsquare scaled 200) ;
> >
> > in base. And then do
> >
> > \dorecurse{5}{
> > \startTEXpage[offset=1DK]
> > \useMPgraphic{layerset#1}
> > \stopTEXpage
> > }
> >
> > if that is the looping you are after.
> >
> > /Mikael
> >
> > On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Resp. the solution should be such that each generated PDF page has the 
> > > same dimension, the same background colour and a page number and the 
> > > metapost content on each page has the same scaling factor.
> > >
> > > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > >
> > > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > > because I need page numbering inside the MPpage, as done with draw 
> > > textext(decimal(currentime)).
> > >
> > > So, how can I use the \useMPgraphic{layerset1} etc. inside the 
> > > \dorecurse, assuming I name my layersets "layerset1", "layerset2", 
> > > "layerset3" etc.?
> > >
> > > Emanuel
> > >
> > > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> > >  wrote:
> > >
> > > Dear Mikael,
> > > thanks a lot!
> > > this seems to be the solution! And it looks beatiful enough to me 
> > > I'll try to port all my layers to this new method and see if I run into 
> > > new problems again 
> > >
> > > Emanuel
> > >
> > >
> > > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > >
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3"

[NTG-context] Fwd: Re: Working with layer sets with Metapost

2024-02-19 Thread Emanuel Han via ntg-context
 I just made a strange observation in the output pdf of the attached layer_set.tex, which is that when opening it with a pdf viewer like skim or macos preview and showing miniatures, all pages except the last one show page number 1 (the last showing page number 2). Which was not the case with the output pdf of the attached multipage_metapost_mwe-very_simple.tex. How can I change my code to have proper consecutive page numbering in a pdf viewer?On Feb. 17 2024, at 11:03 am, Emanuel Han via ntg-context  wrote:I think I could solve all the problems. Attached the finalized working example. I created the https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry with it. Feel free to modify.CheersEmanuelOn Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:Hi,not sure I get what you are missing. But you can trysetbounds currentpicture to (fullsquare scaled 200) ;in base. And then do\dorecurse{5}{\startTEXpage[offset=1DK]\useMPgraphic{layerset#1}\stopTEXpage}if that is the looping you are after./MikaelOn Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context wrote:>> Resp. the solution should be such that each generated PDF page has the same dimension, the same background colour and a page number and the metapost content on each page has the same scaling factor.>> On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,>> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), because I need the "setbounds currentpicture to TheFrame" and also because I need page numbering inside the MPpage, as done with draw textext(decimal(currentime)).>> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?>> Emanuel>> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  wrote:>> Dear Mikael,> thanks a lot!> this seems to be the solution! And it looks beatiful enough to me > I'll try to port all my layers to this new method and see if I run into new problems again >> Emanuel>>> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:>> Hi>> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context>  wrote:> >> > Dear list,> >> > the attached .tex file is the minimal working example we discussed today in the online meeting.> >> > I realized that the approach of looping through k of p[k] is not fitting my needs, because it's not flexible enough.> >> > I need another approach, one which works with layer sets.> >> > I would stop using p as an array, because with the layer sets approach we don't have a fixed order of the layers.> >> > So the definition of the layers would be something like> >> > picture layerA;> > layerA:=image(> > label("Word 1", z1);> > );> >> > picture layerW;> > layerW:=image(> > label("Mot 2", z2);> > );> >> > picture layerM;> > layerM:=image(> > label("Parola 3", z3);> > );> >> > picture layerC;> > layerC:=image(> > label("Wort 4", z3+z1);> > );> >> > picture layerY;> > layerY:=image(> > label("Nummer 5", z2+z3);> > );> >> > picture layerU;> > layerU:=image(> > label("number 6", z2+z1);> > );> >> > After that, I would define layer sets and layer subsets. This will be done manually for each layer set and each layer subset.> > I don't know the proper syntax to do that. Let's assume we could use a variable type called "myset".> >> > myset layersubsetGamma;> > layersubsetGamma:={layerU,layerM};> >> > In my logic, the layers will be drawn in the order of their appearance within the {}. In the example, drawn content of layerM might cover drawn content of layerU.> >> > Contrary to a layer subset, each layer set will result in a PDF page, and thus the layer sets are related to each other by an inner order. That's why I would use an array variable here with [].> >> > I don't know how to append a set. In the following example, I assumed there would be a function myappend(, )> >> > myset layerset[];> > layerset1 := {layerW,layerA};> > layerset2 := myappend{layerset1, layerY};> > layerset3 := myappend{layerset2, layersubsetGamma};> > layerset4 := myappend{layerset2, layerU};> > layerset5 := myappend{layerset4, layersubsetGamma};> >> > Finally, I would need each layerset[k] typeset on its own pdf page. And of course on each page k, only the layers which appear in the definition of the layerset[k] should be drawn on top of each other in the order as they appear in that definition.> >>

[NTG-context] Re: Working with layer sets with Metapost

2024-02-17 Thread Emanuel Han via ntg-context
I think I could solve all the problems. Attached the finalized working example. 
I created the 
https://wiki.contextgarden.net/MetaPost#Layer_sets_as_individual_pages entry 
with it. Feel free to modify.

Cheers
Emanuel

On Feb. 16 2024, at 7:56 am, Mikael Sundqvist  wrote:
> Hi,
>
> not sure I get what you are missing. But you can try
> setbounds currentpicture to (fullsquare scaled 200) ;
> in base. And then do
> \dorecurse{5}{
> \startTEXpage[offset=1DK]
> \useMPgraphic{layerset#1}
> \stopTEXpage
> }
>
> if that is the looping you are after.
> /Mikael
> On Fri, Feb 16, 2024 at 6:54 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Resp. the solution should be such that each generated PDF page has the same 
> > dimension, the same background colour and a page number and the metapost 
> > content on each page has the same scaling factor.
> >
> > On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> >
> > I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> > on), because I need the "setbounds currentpicture to TheFrame" and also 
> > because I need page numbering inside the MPpage, as done with draw 
> > textext(decimal(currentime)).
> >
> > So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> > assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
> >  wrote:
> >
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> >
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myapp

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Resp. the solution should be such that each generated PDF page has the same 
dimension, the same background colour and a page number and the metapost 
content on each page has the same scaling factor.

On Feb. 15 2024, at 11:10 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
>
> I actually need to keep the \dorecurse mechanism of the mwe (from line 44 
> on), because I need the "setbounds currentpicture to TheFrame" and also 
> because I need page numbering inside the MPpage, as done with draw 
> textext(decimal(currentime)).
> So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
> assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
> Emanuel
> On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context 
>  wrote:
> > Dear Mikael,
> > thanks a lot!
> > this seems to be the solution! And it looks beatiful enough to me 
> > I'll try to port all my layers to this new method and see if I run into new 
> > problems again 
> >
> > Emanuel
> >
> > On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > > Hi
> > >
> > > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> > >  wrote:
> > > >
> > > > Dear list,
> > > >
> > > > the attached .tex file is the minimal working example we discussed 
> > > > today in the online meeting.
> > > >
> > > > I realized that the approach of looping through k of p[k] is not 
> > > > fitting my needs, because it's not flexible enough.
> > > >
> > > > I need another approach, one which works with layer sets.
> > > >
> > > > I would stop using p as an array, because with the layer sets approach 
> > > > we don't have a fixed order of the layers.
> > > >
> > > > So the definition of the layers would be something like
> > > >
> > > > picture layerA;
> > > > layerA:=image(
> > > > label("Word 1", z1);
> > > > );
> > > >
> > > > picture layerW;
> > > > layerW:=image(
> > > > label("Mot 2", z2);
> > > > );
> > > >
> > > > picture layerM;
> > > > layerM:=image(
> > > > label("Parola 3", z3);
> > > > );
> > > >
> > > > picture layerC;
> > > > layerC:=image(
> > > > label("Wort 4", z3+z1);
> > > > );
> > > >
> > > > picture layerY;
> > > > layerY:=image(
> > > > label("Nummer 5", z2+z3);
> > > > );
> > > >
> > > > picture layerU;
> > > > layerU:=image(
> > > > label("number 6", z2+z1);
> > > > );
> > > >
> > > > After that, I would define layer sets and layer subsets. This will be 
> > > > done manually for each layer set and each layer subset.
> > > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > > variable type called "myset".
> > > >
> > > > myset layersubsetGamma;
> > > > layersubsetGamma:={layerU,layerM};
> > > >
> > > > In my logic, the layers will be drawn in the order of their appearance 
> > > > within the {}. In the example, drawn content of layerM might cover 
> > > > drawn content of layerU.
> > > >
> > > > Contrary to a layer subset, each layer set will result in a PDF page, 
> > > > and thus the layer sets are related to each other by an inner order. 
> > > > That's why I would use an array variable here with [].
> > > >
> > > > I don't know how to append a set. In the following example, I assumed 
> > > > there would be a function myappend(,  > > > initial set should be appended with>)
> > > >
> > > > myset layerset[];
> > > > layerset1 := {layerW,layerA};
> > > > layerset2 := myappend{layerset1, layerY};
> > > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > > layerset4 := myappend{layerset2, layerU};
> > > > layerset5 := myappend{layerset4, layersubsetGamma};
> > > >
> > > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > > of course on each page k, only the layers which appear in the 
> > > > definition of the layerset[k] should be drawn on top of each other in 
> > > > the order as they appear in 

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Dear Mikael,

I actually need to keep the \dorecurse mechanism of the mwe (from line 44 on), 
because I need the "setbounds currentpicture to TheFrame" and also because I 
need page numbering inside the MPpage, as done with draw 
textext(decimal(currentime)).
So, how can I use the \useMPgraphic{layerset1} etc. inside the \dorecurse, 
assuming I name my layersets "layerset1", "layerset2", "layerset3" etc.?
Emanuel
On Feb. 15 2024, at 10:07 pm, Emanuel Han via ntg-context  
wrote:
> Dear Mikael,
> thanks a lot!
> this seems to be the solution! And it looks beatiful enough to me 
> I'll try to port all my layers to this new method and see if I run into new 
> problems again 
>
> Emanuel
>
> On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> > Hi
> >
> > On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
> >  wrote:
> > >
> > > Dear list,
> > >
> > > the attached .tex file is the minimal working example we discussed today 
> > > in the online meeting.
> > >
> > > I realized that the approach of looping through k of p[k] is not fitting 
> > > my needs, because it's not flexible enough.
> > >
> > > I need another approach, one which works with layer sets.
> > >
> > > I would stop using p as an array, because with the layer sets approach we 
> > > don't have a fixed order of the layers.
> > >
> > > So the definition of the layers would be something like
> > >
> > > picture layerA;
> > > layerA:=image(
> > > label("Word 1", z1);
> > > );
> > >
> > > picture layerW;
> > > layerW:=image(
> > > label("Mot 2", z2);
> > > );
> > >
> > > picture layerM;
> > > layerM:=image(
> > > label("Parola 3", z3);
> > > );
> > >
> > > picture layerC;
> > > layerC:=image(
> > > label("Wort 4", z3+z1);
> > > );
> > >
> > > picture layerY;
> > > layerY:=image(
> > > label("Nummer 5", z2+z3);
> > > );
> > >
> > > picture layerU;
> > > layerU:=image(
> > > label("number 6", z2+z1);
> > > );
> > >
> > > After that, I would define layer sets and layer subsets. This will be 
> > > done manually for each layer set and each layer subset.
> > > I don't know the proper syntax to do that. Let's assume we could use a 
> > > variable type called "myset".
> > >
> > > myset layersubsetGamma;
> > > layersubsetGamma:={layerU,layerM};
> > >
> > > In my logic, the layers will be drawn in the order of their appearance 
> > > within the {}. In the example, drawn content of layerM might cover drawn 
> > > content of layerU.
> > >
> > > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > > thus the layer sets are related to each other by an inner order. That's 
> > > why I would use an array variable here with [].
> > >
> > > I don't know how to append a set. In the following example, I assumed 
> > > there would be a function myappend(,  > > initial set should be appended with>)
> > >
> > > myset layerset[];
> > > layerset1 := {layerW,layerA};
> > > layerset2 := myappend{layerset1, layerY};
> > > layerset3 := myappend{layerset2, layersubsetGamma};
> > > layerset4 := myappend{layerset2, layerU};
> > > layerset5 := myappend{layerset4, layersubsetGamma};
> > >
> > > Finally, I would need each layerset[k] typeset on its own pdf page. And 
> > > of course on each page k, only the layers which appear in the definition 
> > > of the layerset[k] should be drawn on top of each other in the order as 
> > > they appear in that definition.
> > >
> > > I'm very curious to hear your suggestions.
> > >
> >
> > Not beautiful, perhaps, but maybe something like this could work? I
> > think there is no way out of doing some manual work to tell what you
> > want included on each page.
> >
> > \startuseMPgraphic{base}
> > z1 = origin ;
> > z2 = (10,50) ;
> > z3 = (40,30) ;
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > 

[NTG-context] Re: Working with layer sets with Metapost

2024-02-15 Thread Emanuel Han via ntg-context
Dear Mikael,
thanks a lot!
this seems to be the solution! And it looks beatiful enough to me 
I'll try to port all my layers to this new method and see if I run into new 
problems again 

Emanuel

On Feb. 15 2024, at 8:19 am, Mikael Sundqvist  wrote:
> Hi
>
> On Thu, Feb 15, 2024 at 1:03 AM Emanuel Han via ntg-context
>  wrote:
> >
> > Dear list,
> >
> > the attached .tex file is the minimal working example we discussed today in 
> > the online meeting.
> >
> > I realized that the approach of looping through k of p[k] is not fitting my 
> > needs, because it's not flexible enough.
> >
> > I need another approach, one which works with layer sets.
> >
> > I would stop using p as an array, because with the layer sets approach we 
> > don't have a fixed order of the layers.
> >
> > So the definition of the layers would be something like
> >
> > picture layerA;
> > layerA:=image(
> > label("Word 1", z1);
> > );
> >
> > picture layerW;
> > layerW:=image(
> > label("Mot 2", z2);
> > );
> >
> > picture layerM;
> > layerM:=image(
> > label("Parola 3", z3);
> > );
> >
> > picture layerC;
> > layerC:=image(
> > label("Wort 4", z3+z1);
> > );
> >
> > picture layerY;
> > layerY:=image(
> > label("Nummer 5", z2+z3);
> > );
> >
> > picture layerU;
> > layerU:=image(
> > label("number 6", z2+z1);
> > );
> >
> > After that, I would define layer sets and layer subsets. This will be done 
> > manually for each layer set and each layer subset.
> > I don't know the proper syntax to do that. Let's assume we could use a 
> > variable type called "myset".
> >
> > myset layersubsetGamma;
> > layersubsetGamma:={layerU,layerM};
> >
> > In my logic, the layers will be drawn in the order of their appearance 
> > within the {}. In the example, drawn content of layerM might cover drawn 
> > content of layerU.
> >
> > Contrary to a layer subset, each layer set will result in a PDF page, and 
> > thus the layer sets are related to each other by an inner order. That's why 
> > I would use an array variable here with [].
> >
> > I don't know how to append a set. In the following example, I assumed there 
> > would be a function myappend(,  > set should be appended with>)
> >
> > myset layerset[];
> > layerset1 := {layerW,layerA};
> > layerset2 := myappend{layerset1, layerY};
> > layerset3 := myappend{layerset2, layersubsetGamma};
> > layerset4 := myappend{layerset2, layerU};
> > layerset5 := myappend{layerset4, layersubsetGamma};
> >
> > Finally, I would need each layerset[k] typeset on its own pdf page. And of 
> > course on each page k, only the layers which appear in the definition of 
> > the layerset[k] should be drawn on top of each other in the order as they 
> > appear in that definition.
> >
> > I'm very curious to hear your suggestions.
> >
>
> Not beautiful, perhaps, but maybe something like this could work? I
> think there is no way out of doing some manual work to tell what you
> want included on each page.
>
> \startuseMPgraphic{base}
> z1 = origin ;
> z2 = (10,50) ;
> z3 = (40,30) ;
>
> picture layerA;
> layerA:=image(
> label("Word 1", z1);
> );
>
> picture layerW;
> layerW:=image(
> label("Mot 2", z2);
> );
>
> picture layerM;
> layerM:=image(
> label("Parola 3", z3);
> );
>
> picture layerC;
> layerC:=image(
> label("Wort 4", z3+z1);
> );
>
> picture layerY;
> layerY:=image(
> label("Nummer 5", z2+z3);
> );
>
> picture layerU;
> layerU:=image(
> label("number 6", z2+z1);
> );
> \stopuseMPgraphic
>
> \startuseMPgraphic{Gamma}
> draw layerU ;
> draw layerM ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset1}
> \includeMPgraphic{base}
> draw layerW ;
> draw layerA ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset2}
> \includeMPgraphic{layerset1} ;
> draw layerY ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset3}
> \includeMPgraphic{layerset2} ;
> \includeMPgraphic{Gamma} ;
> \stopuseMPgraphic
>
>
> \startuseMPgraphic{layerset4}
> \includeMPgraphic{layerset2} ;
> draw layerU ;
> \stopuseMPgraphic
>
> \startuseMPgraphic{layerset5}
> \includeMPgraphic{layerset4} ;
> \includeMPgraphic{Gamma} ;
> \stopuseMPgraphi

[NTG-context] Working with layer sets with Metapost

2024-02-14 Thread Emanuel Han via ntg-context
Dear list,

the attached .tex file is the minimal working example we discussed today in the 
online meeting.
I realized that the approach of looping through k of p[k] is not fitting my 
needs, because it's not flexible enough.
I need another approach, one which works with layer sets.
I would stop using p as an array, because with the layer sets approach we don't 
have a fixed order of the layers.
So the definition of the layers would be something like
picture layerA;
layerA:=image(
label("Word 1", z1);
);

picture layerW;
layerW:=image(
label("Mot 2", z2);
);

picture layerM;
layerM:=image(
label("Parola 3", z3);
);

picture layerC;
layerC:=image(
label("Wort 4", z3+z1);
);

picture layerY;
layerY:=image(
label("Nummer 5", z2+z3);
);

picture layerU;
layerU:=image(
label("number 6", z2+z1);
);

After that, I would define layer sets and layer subsets. This will be done 
manually for each layer set and each layer subset.
I don't know the proper syntax to do that. Let's assume we could use a variable 
type called "myset".

myset layersubsetGamma;
layersubsetGamma:={layerU,layerM};

In my logic, the layers will be drawn in the order of their appearance within 
the {}. In the example, drawn content of layerM might cover drawn content of 
layerU.
Contrary to a layer subset, each layer set will result in a PDF page, and thus 
the layer sets are related to each other by an inner order. That's why I would 
use an array variable here with [].
I don't know how to append a set. In the following example, I assumed there 
would be a function myappend(, )
myset layerset[];
layerset1 := {layerW,layerA};
layerset2 := myappend{layerset1, layerY};
layerset3 := myappend{layerset2, layersubsetGamma};
layerset4 := myappend{layerset2, layerU};
layerset5 := myappend{layerset4, layersubsetGamma};

Finally, I would need each layerset[k] typeset on its own pdf page. And of 
course on each page k, only the layers which appear in the definition of the 
layerset[k] should be drawn on top of each other in the order as they appear in 
that definition.
I'm very curious to hear your suggestions.
Thanks
Emanuel



multipage_metapost_mwe-very_simple.tex
Description: TeX document
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost: draw only subpath; changing thickness of line

2024-01-06 Thread Emanuel Han via ntg-context
Hi Taco,

thanks for your help. This works for me!
On Jan. 5 2024, at 2:13 pm, Taco Hoekwater  wrote:
> Hi,
>
> Here is 'a' way to draw the subpath, at least. I do not have time to come up 
> with a nice “thicker in the middle” solution.
> Best wishes,
> Taco
>
>
> \startMPcode
> numeric u; u=1cm;
> %equiangular spiral
> numeric a, k ;
> a = 2.3; %scaling factor
> k = 8.61722335;
> path S;
> S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
> draw S;
>
> z1 = 8 dir -14;
> path A; A = origin -- z1 scaled 0.7u ;% draw A;
> pair AEndPoint; AEndPoint = point 1 of A;
> pair gong[], times; numeric n; n = 0;
> numeric gongtimes[]; % new
> for i = 1 upto length(A):
> for j = 1 upto length(S):
> times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
> if xpart times > -1:
> gong[incr n] = 1[point xpart times of subpath (i-1,i) of A,
> point ypart times of subpath (j-1,j) of S];
> gongtimes[n] = j-1 + ypart times; % new
> fi
> endfor
> endfor
>
> % new
> path H; H = subpath(gongtimes[6],gongtimes[7]) of S;
> lH = length(H);
> for i = 1 upto 100:
> draw (subpath((i-1)/100*lH, i/100* lH) of H) withcolor red withpen (pencircle 
> scaled(abs(abs(i-50)-50)/10)) ;
> endfor;
>
> \stopMPcode
>
> > On 5 Jan 2024, at 09:56, Emanuel Han via ntg-context  
> > wrote:
> >
> > Hi all,
> >
> > I have this MWE. Now I want to draw only the subpath of S between gong6 and 
> > gong7 with a red line which is narrower at the two ends and thicker in the 
> > middle part. How to achieve this?
> >
> > Thanks!
> > Emanuel
> >
> > \setuppapersize[A4,landscape]
> >
> > \starttext
> >
> > \startMPcode
> > numeric u; u=1cm;
> > %equiangular spiral
> > numeric a, k ;
> > a = 2.3; %scaling factor
> > k = 8.61722335;
> > path S;
> > S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
> > draw S;
> >
> > z1 = 8 dir -14;
> > path A; A = origin -- z1 scaled 0.7u ; draw A;
> > pair AEndPoint; AEndPoint = point 1 of A;
> > pair gong[], times; numeric n; n = 0;
> > for i = 1 upto length(A):
> > for j = 1 upto length(S):
> > times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
> > if xpart times > -1:
> > gong[incr n] = 1/2[point xpart times of subpath (i-1,i) of A,
> > point ypart times of subpath (j-1,j) of S];
> > fi
> > endfor
> > endfor
> >
> > dotlabel.rt ("$gong6$", gong6);
> > dotlabel.rt ("$gong7$", gong7);
> >
> > %Now I want to draw only the subpath of S between gong6 and gong7 with a 
> > red line which is narrower at the two ends and thicker in the middle part
> >
> > \stopMPcode
> >
> > \stoptext
> > ___
> > If your question is of interest to others as well, please add an entry to 
> > the Wiki!
> >
> > maillist : ntg-context@ntg.nl / 
> > https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> > webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> > archive : https://github.com/contextgarden/context
> > wiki : https://wiki.contextgarden.net
> > ___
>
> —
> 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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: multipage metapost output from ConTeXt

2024-01-06 Thread Emanuel Han via ntg-context
Hi Mikael,

with the solution provided by you, I could work on my graphic which grows from 
page to page. So far I have already 28 pages. Now I would like to go back to 
the summed graphic of p1 to p21 and add the coming p29, p30 etc. to only that 
(that means contents of p22 to p28 should not be visible on pages 29 and 
forward).
I don't bother you with my code which is too long. Let's use the mwe provided 
by you (I added it here for convenience), where we have 3 pages. How can I have 
the content of p2 not be added on page 3 and forward?
\startuseMPgraphic{base}
picture p[];
path TheFrame ;
TheFrame := fullsquare scaled 5in ;
z1 = (60,40);
z2 = (40,90);
z3 = (10,70);

p1:=image(
label("Word 1", z1);
);

p2:=image(
label("Mot 2", z2);
);

p3:=image(
label("Parola 3", z3);
);

\stopuseMPgraphic
\starttext
\dorecurse{3}{ % Frame
\startMPpage[pagestate=start]
\includeMPgraphic{base}
currentime := #1 ;
% Just for learning :
draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
draw textext("T="(currentime)) scaled 2 shifted(0,2in)
withcolor magenta ;
for k=1 upto currentime: addto currentpicture also p[k]; endfor
setbounds currentpicture to TheFrame ;

desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
currentpicture := currentpicture xysized (desiredformat ,desiredformat );
\stopMPpage
}

\stoptext
On Dez. 2 2023, at 7:46 pm, Mikael Sundqvist  wrote:
> Hi,
>
> I don't know if \startMPinclusions \stopMPinclusions shall work with
> \startMPpage and \stopMPpage. In this case, one can use a separate
> graphics:
>
> \startuseMPgraphic{base}
> picture p[];
> path TheFrame ;
> TheFrame := fullsquare scaled 5in ;
> z1 = (60,40);
> z2 = (40,90);
> z3 = (10,70);
>
> p1:=image(
> label("Word 1", z1);
> );
>
> p2:=image(
> label("Mot 2", z2);
> );
>
> p3:=image(
> label("Parola 3", z3);
> );
>
> \stopuseMPgraphic
> \starttext
> \dorecurse{3}{ % Frame
> \startMPpage[pagestate=start]
> \includeMPgraphic{base}
> currentime := #1 ;
> % Just for learning :
> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> draw textext("T="(currentime)) scaled 2 shifted(0,2in)
> withcolor magenta ;
> for k=1 upto currentime: addto currentpicture also p[k]; endfor
> setbounds currentpicture to TheFrame ;
>
> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> \stopMPpage
> }
>
> \stoptext
> /Mikael
> On Sat, Dec 2, 2023 at 6:14 PM Emanuel Han via ntg-context
>  wrote:
> >
> > Hi Mikael,
> >
> > here's a very simple mwe for the label(textext()) issue. On page 1, the 
> > text "Word 1" should be drawn in position z1. On page 2, the same text in 
> > the same position should be visible, and the text "Mot 2" in position p2 
> > should be added. And so on.
> >
> > \startMPinclusions
> >
> > picture p[];
> > path TheFrame ;
> > TheFrame := fullsquare scaled 5in ;
> >
> > z1 = (60,40);
> > z2 = (40,90);
> > z3 = (10,70);
> >
> > p1:=image(
> > label(textext("Word 1"), z1);
> > );
> >
> > p2:=image(
> > label(textext("Mot 2"), z2);
> > );
> >
> > p3:=image(
> > label(textext("Parola 3"), z3);
> > );
> >
> > \stopMPinclusions
> >
> > \starttext
> >
> > \dorecurse{3}{ % Frame
> > \startMPpage[pagestate=start]
> > currentime := #1 ;
> > % Just for learning :
> > draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> > draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> > magenta ;
> > for k=1 upto currentime: draw p[k]; endfor
> > setbounds currentpicture to TheFrame ;
> >
> > desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> > currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >
> > \stopMPpage
> > }
> >
> > \stoptext
> >
> > On Dez. 2 2023, at 5:22 pm, Mikael Sundqvist  wrote:
> >
> > Hi Emanuel,
> >
> > I am not sure I understand your question, and since you use fonts that
> > i do not have, I cannot test your example as is. But, maybe, if you
> > want to redraw a picture, you can do
> >
> > addto currentpicture also p1;
> >
> > where you want it.
> >
> > /Mikael
> >
> > PS For the text thing, I did not get it. Could one have a _very
> > simple_ example showing only that problem and no other problem?
> >
> > On Sat, Dec 2, 2

[NTG-context] Metapost: draw only subpath; changing thickness of line

2024-01-05 Thread Emanuel Han via ntg-context
Hi all,

I have this MWE. Now I want to draw only the subpath of S between gong6 and 
gong7 with a red line which is narrower at the two ends and thicker in the 
middle part. How to achieve this?
Thanks!
Emanuel

\setuppapersize[A4,landscape]
\starttext
\startMPcode
numeric u; u=1cm;
%equiangular spiral
numeric a, k ;
a = 2.3; %scaling factor
k = 8.61722335;
path S;
S = right for t=1 upto 360: .. a ** (t/50.2) * dir (-k*t) endfor;
draw S;

z1 = 8 dir -14;
path A; A = origin -- z1 scaled 0.7u ; draw A;
pair AEndPoint; AEndPoint = point 1 of A;
pair gong[], times; numeric n; n = 0;
for i = 1 upto length(A):
for j = 1 upto length(S):
times := subpath (i-1,i) of A intersectiontimes subpath (j-1,j) of S;
if xpart times > -1:
gong[incr n] = 1/2[point xpart times of subpath (i-1,i) of A,
point ypart times of subpath (j-1,j) of S];
fi
endfor
endfor

dotlabel.rt ("$gong6$", gong6);
dotlabel.rt ("$gong7$", gong7);

%Now I want to draw only the subpath of S between gong6 and gong7 with a red 
line which is narrower at the two ends and thicker in the middle part
\stopMPcode
\stoptext___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
Thank you Mikael,
this works!
Emanuel

On Dez. 2 2023, at 7:46 pm, Mikael Sundqvist  wrote:
> Hi,
>
> I don't know if \startMPinclusions \stopMPinclusions shall work with
> \startMPpage and \stopMPpage. In this case, one can use a separate
> graphics:
>
> \startuseMPgraphic{base}
> picture p[];
> path TheFrame ;
> TheFrame := fullsquare scaled 5in ;
> z1 = (60,40);
> z2 = (40,90);
> z3 = (10,70);
>
> p1:=image(
> label("Word 1", z1);
> );
>
> p2:=image(
> label("Mot 2", z2);
> );
>
> p3:=image(
> label("Parola 3", z3);
> );
>
> \stopuseMPgraphic
> \starttext
> \dorecurse{3}{ % Frame
> \startMPpage[pagestate=start]
> \includeMPgraphic{base}
> currentime := #1 ;
> % Just for learning :
> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> draw textext("T="(currentime)) scaled 2 shifted(0,2in)
> withcolor magenta ;
> for k=1 upto currentime: addto currentpicture also p[k]; endfor
> setbounds currentpicture to TheFrame ;
>
> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> \stopMPpage
> }
>
> \stoptext
> /Mikael
> On Sat, Dec 2, 2023 at 6:14 PM Emanuel Han via ntg-context
>  wrote:
> >
> > Hi Mikael,
> >
> > here's a very simple mwe for the label(textext()) issue. On page 1, the 
> > text "Word 1" should be drawn in position z1. On page 2, the same text in 
> > the same position should be visible, and the text "Mot 2" in position p2 
> > should be added. And so on.
> >
> > \startMPinclusions
> >
> > picture p[];
> > path TheFrame ;
> > TheFrame := fullsquare scaled 5in ;
> >
> > z1 = (60,40);
> > z2 = (40,90);
> > z3 = (10,70);
> >
> > p1:=image(
> > label(textext("Word 1"), z1);
> > );
> >
> > p2:=image(
> > label(textext("Mot 2"), z2);
> > );
> >
> > p3:=image(
> > label(textext("Parola 3"), z3);
> > );
> >
> > \stopMPinclusions
> >
> > \starttext
> >
> > \dorecurse{3}{ % Frame
> > \startMPpage[pagestate=start]
> > currentime := #1 ;
> > % Just for learning :
> > draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> > draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> > magenta ;
> > for k=1 upto currentime: draw p[k]; endfor
> > setbounds currentpicture to TheFrame ;
> >
> > desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> > currentpicture := currentpicture xysized (desiredformat ,desiredformat );
> >
> > \stopMPpage
> > }
> >
> > \stoptext
> >
> > On Dez. 2 2023, at 5:22 pm, Mikael Sundqvist  wrote:
> >
> > Hi Emanuel,
> >
> > I am not sure I understand your question, and since you use fonts that
> > i do not have, I cannot test your example as is. But, maybe, if you
> > want to redraw a picture, you can do
> >
> > addto currentpicture also p1;
> >
> > where you want it.
> >
> > /Mikael
> >
> > PS For the text thing, I did not get it. Could one have a _very
> > simple_ example showing only that problem and no other problem?
> >
> > On Sat, Dec 2, 2023 at 12:58 PM fv leung  wrote:
> > >
> > > You didn't specify the color of path A in p2 and p4. So it's drawn in 
> > > black.
> > > The other issue, I can't help.
> > >
> > > Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:
> > >>
> > >> So is there a way to circumvent these issues? Or an explanation for this 
> > >> behavior, so that I can try to find a solution by myself?
> > >>
> > >> Thanks
> > >> Emanuel
> > >>
> > >> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context 
> > >>  wrote:
> > >>
> > >> Dear Aditya and Fabrice,
> > >> thanks for your responses.
> > >>
> > >> I included some of Fabrice's code into mine for testing purpose, and 
> > >> indeed the multipage works now.
> > >> What is bizarre is that issues appear now that didn't appear before:
> > >>
> > >> Path A is drawn with color red on page 1, and in color black on all 
> > >> following pages, while it should stay red.
> > >> textext(, ) is overwriting  with 
> > >> "T="(currentime) which has been used previously in textext() 
> > >> b

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
Hi Mikael,

here's a very simple mwe for the label(textext()) issue. On page 1, the text 
"Word 1" should be drawn in position z1. On page 2, the same text in the same 
position should be visible, and the text "Mot 2" in position p2 should be 
added. And so on.
\startMPinclusions
picture p[];
path TheFrame ;
TheFrame := fullsquare scaled 5in ;

z1 = (60,40);
z2 = (40,90);
z3 = (10,70);

p1:=image(
label(textext("Word 1"), z1);
);

p2:=image(
label(textext("Mot 2"), z2);
);

p3:=image(
label(textext("Parola 3"), z3);
);

\stopMPinclusions
\starttext
\dorecurse{3}{ % Frame
\startMPpage[pagestate=start]
currentime := #1 ;
% Just for learning :
draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
magenta ;
for k=1 upto currentime: draw p[k]; endfor
setbounds currentpicture to TheFrame ;

desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
currentpicture := currentpicture xysized (desiredformat ,desiredformat );

\stopMPpage
}

\stoptext
On Dez. 2 2023, at 5:22 pm, Mikael Sundqvist  wrote:
> Hi Emanuel,
>
> I am not sure I understand your question, and since you use fonts that
> i do not have, I cannot test your example as is. But, maybe, if you
> want to redraw a picture, you can do
>
> addto currentpicture also p1;
> where you want it.
> /Mikael
> PS For the text thing, I did not get it. Could one have a _very
> simple_ example showing only that problem and no other problem?
>
> On Sat, Dec 2, 2023 at 12:58 PM fv leung  wrote:
> >
> > You didn't specify the color of path A in p2 and p4. So it's drawn in black.
> > The other issue, I can't help.
> >
> > Emanuel Han via ntg-context  於 2023年12月2日 週六 下午7:23寫道:
> >>
> >> So is there a way to circumvent these issues? Or an explanation for this 
> >> behavior, so that I can try to find a solution by myself?
> >>
> >> Thanks
> >> Emanuel
> >>
> >> On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context 
> >>  wrote:
> >>
> >> Dear Aditya and Fabrice,
> >> thanks for your responses.
> >>
> >> I included some of Fabrice's code into mine for testing purpose, and 
> >> indeed the multipage works now.
> >> What is bizarre is that issues appear now that didn't appear before:
> >>
> >> Path A is drawn with color red on page 1, and in color black on all 
> >> following pages, while it should stay red.
> >> textext(, ) is overwriting  with 
> >> "T="(currentime) which has been used previously in textext() 
> >> before the for k=1 endfor loop. This overwriting happens only for the 
> >> first textext() which occurs inside the for k=1 endfor loop. All other 
> >> textext() inside the for k=1 endfor loop are not drawn at all. If the line 
> >> « draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> >> magenta ; » is commented out, the first textext() inside the for k=1 
> >> endfor loop is not drawn neither. It must be an issue with textext(), 
> >> because when I replace textext() by lmt_outline[], the text is drawn.
> >>
> >> Adjusted mwe:
> >>
> >> \enableregime[utf] % enable unicoded input
> >>
> >> \definefontfamily [RomanFont] [rm] [calluna]
> >>
> >> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> >>
> >> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> >>
> >> \definefontfeature
> >> [fea]
> >> [mode=node,language=dflt,script=arab,
> >> init=yes,
> >> medi=yes,
> >> fina=yes,
> >> isol=yes,
> >> calt=yes,
> >> rlig=yes,
> >> tlig=yes,
> >> trep=yes,
> >> curs=yes,
> >> kern=yes,
> >> mark=yes
> >> ]
> >>
> >> \starttypescript [serif] [notonaskharabic]
> >> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
> >> [features=fea]
> >> \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> >> [features=fea]
> >> \stoptypescript
> >>
> >> \starttypescript [serif] [notonaskharabic]
> >> \usetypescript[serif][fallback]
> >> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> >> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
&g

[NTG-context] Re: multipage metapost output from ConTeXt

2023-12-02 Thread Emanuel Han via ntg-context
So is there a way to circumvent these issues? Or an explanation for this 
behavior, so that I can try to find a solution by myself?

Thanks
Emanuel

On Nov. 29 2023, at 12:25 pm, Emanuel Han via ntg-context  
wrote:
> Dear Aditya and Fabrice,
> thanks for your responses.
>
> I included some of Fabrice's code into mine for testing purpose, and indeed 
> the multipage works now.
> What is bizarre is that issues appear now that didn't appear before:
> Path A is drawn with color red on page 1, and in color black on all following 
> pages, while it should stay red.
>
> textext(, ) is overwriting  with "T="(currentime) 
> which has been used previously in textext() before the for k=1 endfor loop. 
> This overwriting happens only for the first textext() which occurs inside the 
> for k=1 endfor loop. All other textext() inside the for k=1 endfor loop are 
> not drawn at all. If the line « draw textext("T="(currentime)) scaled 
> 2 shifted(0,2in) withcolor magenta ; » is commented out, the first textext() 
> inside the for k=1 endfor loop is not drawn neither. It must be an issue with 
> textext(), because when I replace textext() by lmt_outline[], the text is 
> drawn.
>
>
> Adjusted mwe:
>
> \enableregime[utf] % enable unicoded input
> \definefontfamily [RomanFont] [rm] [calluna]
> \definefontfamily [KoreanFont] [rm] [applemyungjo]
> \definefontfamily [JapaneseFont] [rm] [hannotatesc]
> \definefontfeature
> [fea]
> [mode=node,language=dflt,script=arab,
> init=yes,
> medi=yes,
> fina=yes,
> isol=yes,
> calt=yes,
> rlig=yes,
> tlig=yes,
> trep=yes,
> curs=yes,
> kern=yes,
> mark=yes
> ]
>
> \starttypescript [serif] [notonaskharabic]
> \definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] 
> [features=fea]
> \definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] 
> [features=fea]
> \definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
> [features=fea]
> \definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
> [features=fea]
> \stoptypescript
>
> \starttypescript [serif] [notonaskharabic]
> \usetypescript[serif][fallback]
> \definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
> \definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
> \definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
> \definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
> [features=fea]
> \stoptypescript
>
> \starttypescript [notonaskharabic]
> \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
> \stoptypescript
>
> \usetypescript[notonaskharabic]
> \setupbodyfont [RomanFont]
>
> \usecolors[crayola]
>
> \startMPinclusions
> picture p[];
> path TheFrame ;
> TheFrame := fullsquare scaled 5in ;
>
> z0 = (0,0);
> z1 = (60,40);
> z2 = (40,90);
> z3 = (10,70);
> z4 = (30,50);
> z5 = (90,70);
> z6 = (-10,70);
>
> path A; A = z0..z1..z2..z3..z4 ;
> pair AStartPoint; AStartPoint = point 0 of A;
> pair AEndPoint; AEndPoint = point 4 of A;
> path B; B = z5..z6;
> pair BStartPoint; BStartPoint = point 0 of B;
> pair BEndPoint; BEndPoint = point 1 of B;
> path C; C = AStartPoint..AEndPoint;
>
> p1:=image(
> draw A withcolor red;
> );
>
> p2:=image(draw A; label(lmt_outline [
> text = "\JapaneseFont 日本語"
> ], AEndPoint););
>
> p3:=image(
> label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, BStartPoint);
> );
>
> p4:=image(draw A; label(lmt_outline [
> text = "\KoreanFont 한국어"
> ], AStartPoint););
>
> p5:=image(
> label(textext("bāng"), BEndPoint);
> draw C withcolor green;
> );
>
> p6:=image(
> draw B withcolor blue;
> );
> \stopMPinclusions
>
> \starttext
> \dorecurse{6}{ % Frame
> \setupMPpage[background=color, backgroundcolor=SpringGreen]
> \startMPpage[pagestate=start]
> currentime := #1 ;
> % Just for learning :
> draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
> draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
> magenta ;
> for k=1 upto currentime: draw p[k]; endfor
> setbounds currentpicture to TheFrame ;
>
> desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
> currentpicture := currentpicture xysized (desiredformat ,desiredformat );
>
> \stopMPpage
> }
>
> \stoptext
> On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> > On Mon, 27 Nov 2023, Fabrice L wrote:
> >
> > > Hi,
> > >
> > > It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage 
> > > multiple times. Here is an example which build an anima

[NTG-context] Re: multipage metapost output from ConTeXt

2023-11-29 Thread Emanuel Han via ntg-context
Dear Aditya and Fabrice,
thanks for your responses.

I included some of Fabrice's code into mine for testing purpose, and indeed the 
multipage works now.
What is bizarre is that issues appear now that didn't appear before:
Path A is drawn with color red on page 1, and in color black on all following 
pages, while it should stay red.

textext(, ) is overwriting  with "T="(currentime) 
which has been used previously in textext() before the for k=1 endfor loop. 
This overwriting happens only for the first textext() which occurs inside the 
for k=1 endfor loop. All other textext() inside the for k=1 endfor loop are not 
drawn at all. If the line « draw textext("T="(currentime)) scaled 2 
shifted(0,2in) withcolor magenta ; » is commented out, the first textext() 
inside the for k=1 endfor loop is not drawn neither. It must be an issue with 
textext(), because when I replace textext() by lmt_outline[], the text is drawn.

Adjusted mwe:

\enableregime[utf] % enable unicoded input
\definefontfamily [RomanFont] [rm] [calluna]
\definefontfamily [KoreanFont] [rm] [applemyungjo]
\definefontfamily [JapaneseFont] [rm] [hannotatesc]
\definefontfeature
[fea]
[mode=node,language=dflt,script=arab,
init=yes,
medi=yes,
fina=yes,
isol=yes,
calt=yes,
rlig=yes,
tlig=yes,
trep=yes,
curs=yes,
kern=yes,
mark=yes
]

\starttypescript [serif] [notonaskharabic]
\definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] [features=fea]
\definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] [features=fea]
\definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
[features=fea]
\definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
[features=fea]
\stoptypescript

\starttypescript [serif] [notonaskharabic]
\usetypescript[serif][fallback]
\definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
\definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
\definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
\definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
[features=fea]
\stoptypescript

\starttypescript [notonaskharabic]
\definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
\stoptypescript

\usetypescript[notonaskharabic]
\setupbodyfont [RomanFont]

\usecolors[crayola]

\startMPinclusions
picture p[];
path TheFrame ;
TheFrame := fullsquare scaled 5in ;

z0 = (0,0);
z1 = (60,40);
z2 = (40,90);
z3 = (10,70);
z4 = (30,50);
z5 = (90,70);
z6 = (-10,70);

path A; A = z0..z1..z2..z3..z4 ;
pair AStartPoint; AStartPoint = point 0 of A;
pair AEndPoint; AEndPoint = point 4 of A;
path B; B = z5..z6;
pair BStartPoint; BStartPoint = point 0 of B;
pair BEndPoint; BEndPoint = point 1 of B;
path C; C = AStartPoint..AEndPoint;

p1:=image(
draw A withcolor red;
);

p2:=image(draw A; label(lmt_outline [
text = "\JapaneseFont 日本語"
], AEndPoint););

p3:=image(
label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, BStartPoint);
);

p4:=image(draw A; label(lmt_outline [
text = "\KoreanFont 한국어"
], AStartPoint););

p5:=image(
label(textext("bāng"), BEndPoint);
draw C withcolor green;
);

p6:=image(
draw B withcolor blue;
);
\stopMPinclusions

\starttext
\dorecurse{6}{ % Frame
\setupMPpage[background=color, backgroundcolor=SpringGreen]
\startMPpage[pagestate=start]
currentime := #1 ;
% Just for learning :
draw TheFrame withpen pencircle scaled .1in withcolor magenta ;
draw textext("T="(currentime)) scaled 2 shifted(0,2in) withcolor 
magenta ;
for k=1 upto currentime: draw p[k]; endfor
setbounds currentpicture to TheFrame ;

desiredformat := 1080;% In pixels (will be converted by default at 72dpi)
currentpicture := currentpicture xysized (desiredformat ,desiredformat );

\stopMPpage
}

\stoptext
On Nov. 27 2023, at 11:25 pm, Aditya Mahajan  wrote:
> On Mon, 27 Nov 2023, Fabrice L wrote:
>
> > Hi,
> >
> > It is fun fact very easy to do. You just use \startMPpage (…) \stopMPpage 
> > multiple times. Here is an example which build an animation of a particle 
> > moving according to a Brownian motion.
>
> A very similar option is to pass a variable to a metapost drawing. This is 
> what I use:
> https://adityam.github.io/context-blog/post/metapost-animation/
> It only works when viewed in acrobat, you can just comment out the animation 
> part and wrap it in \startTEXpage .. \stopTEXpage to get multi-page animation.
> Aditya___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
>
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___
>

___
If your question 

[NTG-context] multipage metapost output from ConTeXt

2023-11-27 Thread Emanuel Han via ntg-context
How can I achieve multipage metapost output from ConTeXt? The result should be 
a multipage pdf. It contains just a metapost graphic per page. The graphic has 
always the same bounding box and evolves from page to page: Some elements to be 
drawn are added, and some others would ideally also be removed, while keeping 
elements which has already been drawn on previous pages. I can manage when it 
is not possible to remove elements (in that case I'll just cover them with a 
covering element).

I saw that it is possible to achieve my goal with standalone metapost, as 
described here: 
https://tex.stackexchange.com/questions/471662/mptopdf-is-multipage-output-pdf-possible
But I'll need to achieve this with Metapost inside ConTeXt because I use labels 
in Metapost which print text in Japanese, Korean , Arabic and Roman script: 
Thanks to ConTeXt, I can define appropriate fonts for each script. All this 
works already in my working example.
The only unsolved problem is to ship out multiple pages.
For the minimal working example, I didn't remove the font defining part, 
because having 4 different fonts is a condition of my use case. The graphic on 
the other hand is some simple dummy nonsense graphic not from my project. The 
graphic is in the provided example drawn as a summing up of layered drawing 
steps (6 steps, to be precise), so no removing is implemented here (because I 
don't know how that would be done). If each of the figures 1 to 6 of my mwe can 
be put alone on a page, I'd be already very happy. Now, they're put on top of 
each other all on the same single page, also on top of figure 0.
The desired multipage pdf will be used in presentation mode of a pdf viewer and 
skipped forward and backward from page to page (that is from drawing step to 
drawing step).
mwe:
\enableregime[utf] % enable unicoded input
\definefontfamily [RomanFont] [rm] [calluna]
\definefontfamily [KoreanFont] [rm] [applemyungjo]
\definefontfamily [JapaneseFont] [rm] [hannotatesc]
\definefontfeature
[fea]
[mode=node,language=dflt,script=arab,
init=yes,
medi=yes,
fina=yes,
isol=yes,
calt=yes,
rlig=yes,
tlig=yes,
trep=yes,
curs=yes,
kern=yes,
mark=yes
]

\starttypescript [serif] [notonaskharabic]
\definefontsynonym [notonaskharabic-Light] [name:notonaskharabic] [features=fea]
\definefontsynonym [notonaskharabic-Bold] [name:notonaskharabic] [features=fea]
\definefontsynonym [notonaskharabic-Italic] [name:notonaskharabic] 
[features=fea]
\definefontsynonym [notonaskharabic-Bold-Italic] [name:notonaskharabic] 
[features=fea]
\stoptypescript

\starttypescript [serif] [notonaskharabic]
\usetypescript[serif][fallback]
\definefontsynonym [Serif] [notonaskharabic-Light] [features=fea]
\definefontsynonym [SerifItalic] [notonaskharabic-Italic] [features=fea]
\definefontsynonym [SerifBold] [notonaskharabic-Bold] [features=fea]
\definefontsynonym [SerifBoldItalic] [notonaskharabic-Bold-Italic] 
[features=fea]
\stoptypescript

\starttypescript [notonaskharabic]
\definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] [default]
\stoptypescript

\usetypescript[notonaskharabic]
\setupbodyfont [RomanFont]

\starttext
\startMPcode
picture p[];
path bb; %bounding box

z0 = (0,0);
z1 = (60,40);
z2 = (40,90);
z3 = (10,70);
z4 = (30,50);
z5 = (90,70);
z6 = (-10,70);

path A; A = z0..z1..z2..z3..z4 ;
pair AStartPoint; AStartPoint = point 0 of A;
pair AEndPoint; AEndPoint = point 4 of A;
path B; B = z5..z6;
pair BStartPoint; BStartPoint = point 0 of B;
pair BEndPoint; BEndPoint = point 1 of B;
path C; C = AStartPoint..AEndPoint;

% drawing steps:
p1:=image(
draw A withcolor red;
);

p2:=image(
label(textext("\JapaneseFont 日本語"), AEndPoint);
);

p3:=image(
label(textext("\notonaskharabic \textdir TRT دانگ") scaled 1.2, AStartPoint);
);

p4:=image(
label(textext("\KoreanFont 한국어"), BStartPoint);
);

p5:=image(
label(textext("\RomanFont bāng"), BEndPoint);
draw C withcolor green;
);

p6:=image(
draw B withcolor blue;
);

beginfig(0); %% the whole picture for the common bbox
for k=1 upto 6: draw p[k]; endfor
bb:=bbox(currentpicture);
endfig;

for $=1 upto 6:
beginfig($);
for k=1 upto $: draw p[k]; endfor
setbounds currentpicture to bb;
endfig;
endfor

\stopMPcode
\stoptext

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Metapost label text surrounded by white border

2023-11-20 Thread Emanuel Han via ntg-context
Thanks Hraban. This indeed helped. 

It‘s my first reply in this mailing list. Hope I do it right by „replying to 
all“.

> Am 19.11.2023 um 19:37 schrieb Henning Hraban Ramm :
> 
> Am 19.11.23 um 16:41 schrieb Emanuel Han via ntg-context:
>> I'd like to surround black text with a white 1mm thick border in a Metapost 
>> label. Here is my code, which doesn't draw the border at all and which draws 
>> the text in white instead of black (I'm using mkiv and mkxl version 
>> 2023.09.26 18:19 on osx-arm6):
>> |
>> |beginfig(1);
>> % Define the text and colors
>> string label_text;
>> label_text = "Your Text";
>> color text_color, border_color;
>> text_color = black;
>> border_color = white;
>> % Draw the label with the specified colors
>> label(textext(label_text) scaled 1.0, origin) withcolor text_color 
>> withpen pencircle scaled 1mm withcolor border_color;
>> endfig;|
> 
> Have a look into luametafun.pdf (p.10) if lmt_outline does what you want.
> 
> Hraban
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki : https://wiki.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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Metapost label text surrounded by white border

2023-11-19 Thread Emanuel Han via ntg-context
I'd like to surround black text with a white 1mm thick border in a Metapost 
label. Here is my code, which doesn't draw the border at all and which draws 
the text in white instead of black (I'm using mkiv and mkxl version 2023.09.26 
18:19 on osx-arm6):

beginfig(1);
% Define the text and colors
string label_text;
label_text = "Your Text";
color text_color, border_color;
text_color = black;
border_color = white;
% Draw the label with the specified colors
label(textext(label_text) scaled 1.0, origin) withcolor text_color withpen 
pencircle scaled 1mm withcolor border_color;
endfig;___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] How to switch back to default font size after having used \tfa

2023-06-05 Thread Emanuel Han via ntg-context
\tf doesn't work.

version used: 2023.06.04 18:58

MWE:
\starttext a\tfa a \tf a\stoptext
should make default size a followed by 1.2 sized a followed by default size a
but instead, it's default size a followed by 1.2 sized a followed by 1.2 sized a

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