From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 6600 invoked from network); 27 Nov 2023 19:56:57 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 27 Nov 2023 19:56:57 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 18F6A483B5A for ; Mon, 27 Nov 2023 20:56:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7M1h64qcISX4 for ; Mon, 27 Nov 2023 20:56:55 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 63666483B2E for ; Mon, 27 Nov 2023 20:56:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 3A03E483B23 for ; Mon, 27 Nov 2023 20:56:49 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nVvVJT-qfm4r for ; Mon, 27 Nov 2023 20:56:47 +0100 (CET) Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id BE055483B22 for ; Mon, 27 Nov 2023 20:56:47 +0100 (CET) Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-7788f513872so253049485a.1 for ; Mon, 27 Nov 2023 11:56:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701115006; x=1701719806; darn=ntg.nl; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=FPhYm1E0zdFubuIFJq/r8icDepvx0ka0JJ9xxk00s6E=; b=C9oEnd1viEh0GaJoMEN9MT2GrqJnObqC/AIRhp6MJpepduRw0iwS/05rUSNVI9nrnv 63339QPEVdIMbFzz+O7TAft1cmXwwBh+QzxeGuMLDWsZq7UWag80D2PMdMUxUdJNd3j0 wB8AjorjbvH5Gq6Cmy4l+nuuwUZD/QVFw8FKSdPjCtY6Fn98+M3NxzA+pfpukTBI5vQD d9ad0YWsmEAT8bXQWM9idafZOcTgY1UOw2nHUooNDW9CAOVoMCnlRbW2AvwJkSs76ZBT OCC0lJOxeQj1ycyNsJQVw0ix1xEsUSzyu+cdiLxEaRAEcHYijuNH6HSqF5FO4BIs6S+4 wYbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701115006; x=1701719806; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FPhYm1E0zdFubuIFJq/r8icDepvx0ka0JJ9xxk00s6E=; b=XmpWhsGkLrACSERmgcMV9W8A1teMQmaYIcocLxEpsCBo3bq3p99YY+0hWyme2HZ//C QMuV0NBYLKmmM4A45TW3CU2QlFe+IGjEv7tOoyET931c3lgQBXGkZgjge9aqRpDpPCjz mB7tNYrJV1ONB3JY8tbxNYQXGoAdbv2OyGRV1odDBDvPSzISnT3zvt+sP9dKDe5YZDIu Ibk/mc/Lx2uTwcrTJoc4AWMkUicJIPZHRem0mAhZUg25VZr2Zbo93Z9dP4SPQXM4nP9s urbMcOPz+AKqmjxOZGoKezwgIqcmTle9trSCFSxhkSAHm7YFy7pSLcquwaU3ikekMjhV aRoA== X-Gm-Message-State: AOJu0YyhYfAZnHBmbyttUrKkPzv2Q4ifev5PGh/4LV/ejnGIhSzfZqOY Or8vOj+mFMBImtwG40/E3k09G1SljkU= X-Google-Smtp-Source: AGHT+IFQ66AYg/7G+qczumt0ZWLXeDnHAvQlOx6ak7TKs5xUuKUIUzfcJjCI7rovJRAcAYLZb7elHQ== X-Received: by 2002:a05:620a:4408:b0:77d:95f2:3960 with SMTP id v8-20020a05620a440800b0077d95f23960mr10361548qkp.8.1701115005988; Mon, 27 Nov 2023 11:56:45 -0800 (PST) Received: from smtpclient.apple ([132.208.146.136]) by smtp.gmail.com with ESMTPSA id b20-20020a05620a0cd400b00774830b40d4sm3955741qkj.47.2023.11.27.11.56.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Nov 2023 11:56:45 -0800 (PST) From: Fabrice L Message-Id: <8D8705B2-A753-4B9F-8409-84A65CBE6D1A@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Date: Mon, 27 Nov 2023 14:56:34 -0500 In-Reply-To: To: mailing list for ConTeXt users References: X-Mailer: Apple Mail (2.3731.700.6) Message-ID-Hash: EQXF3DLK2OUERS3OXHEU54OMKQKWSKFG X-Message-ID-Hash: EQXF3DLK2OUERS3OXHEU54OMKQKWSKFG X-MailFrom: fabrice.alpha@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Re: multipage metapost output from ConTeXt List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============1609599315564928773==" --===============1609599315564928773== Content-Type: multipart/alternative; boundary="Apple-Mail=_1FA45C3D-8306-4A5C-A1F3-136D8D98D3D1" --Apple-Mail=_1FA45C3D-8306-4A5C-A1F3-136D8D98D3D1 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi, It is fun fact very easy to do. You just use \startMPpage (=E2=80=A6) = \stopMPpage multiple times. Here is an example which build an animation = of a particle moving according to a Brownian motion.=20 Fabrice. % 8< ----------------------------------------------- \usecolors[crayola] \setupMPinstance \starttext % We can put in the inclusions the material we will use at each page, to = declare things only one time. \startMPinclusions % the frame of the video ; path TheFrame ; TheFrame :=3D fullsquare scaled 5in ; randomseed :=3D 53 ; path TheBrownianMotion ; pair Coordinate[]; Coordinate[0] :=3D (0,0); TheBrownianMotion :=3D Coordinate[0] ; variance :=3D 10 ; \stopMPinclusions \dorecurse{600}{ % Frame \setupMPpage[background=3Dcolor, backgroundcolor=3DSpringGreen] \startMPpage[pagestate=3Dstart] currentime :=3D #1 ; % Just for learning : draw TheFrame withpen pencircle scaled .1in withcolor magenta ; draw textext("T=3D"&decimal(currentime)) scaled 2 shifted(0,2in) = withcolor magenta ; Coordinate[currentime] :=3D Coordinate[currentime-1] + = %(normaldeviate*variance,normaldeviate*variance) ; ((uniformdeviate(1)-0.5)*variance,(uniformdeviate(1)-0.5)*variance) ; TheBrownianMotion :=3D for p=3D0 upto (currentime-1) : Coordinate[p] .. endfor Coordinate[currentime] ; draw TheBrownianMotion withpen pencircle scaled .01in withcolor blue ; draw Coordinate[currentime] withpen pencircle scaled .10in withcolor red = ; setbounds currentpicture to TheFrame ; desiredformat :=3D 1080;% In pixels (will be converted by default at = 72dpi) currentpicture :=3D currentpicture xysized (desiredformat ,desiredformat = ); \stopMPpage }=20 \stoptext % 8< ----------------------------------------------- > Le 27 nov. 2023 =C3=A0 13:49, Emanuel Han via ntg-context = a =C3=A9crit : >=20 > 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). >=20 > 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. >=20 > The only unsolved problem is to ship out multiple pages. >=20 > 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. >=20 > 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). >=20 > mwe: >=20 > \enableregime[utf] % enable unicoded input >=20 > \definefontfamily [RomanFont] [rm] [calluna] >=20 > \definefontfamily [KoreanFont] [rm] [applemyungjo] >=20 > \definefontfamily [JapaneseFont] [rm] [hannotatesc] >=20 > \definefontfeature > [fea] > [mode=3Dnode,language=3Ddflt,script=3Darab, > init=3Dyes, > medi=3Dyes, > fina=3Dyes, > isol=3Dyes, > calt=3Dyes, > rlig=3Dyes, > tlig=3Dyes, > trep=3Dyes, > curs=3Dyes, > kern=3Dyes, > mark=3Dyes > ] >=20 > \starttypescript [serif] [notonaskharabic] > \definefontsynonym [notonaskharabic-Light] = [name:notonaskharabic] [features=3Dfea] > \definefontsynonym [notonaskharabic-Bold] = [name:notonaskharabic] [features=3Dfea] > \definefontsynonym [notonaskharabic-Italic] = [name:notonaskharabic] [features=3Dfea] > \definefontsynonym [notonaskharabic-Bold-Italic] = [name:notonaskharabic] [features=3Dfea] > \stoptypescript >=20 > \starttypescript [serif] [notonaskharabic] > \usetypescript[serif][fallback] > \definefontsynonym [Serif] = [notonaskharabic-Light] [features=3Dfea] > \definefontsynonym [SerifItalic] = [notonaskharabic-Italic] [features=3Dfea] > \definefontsynonym [SerifBold] = [notonaskharabic-Bold] [features=3Dfea] > \definefontsynonym [SerifBoldItalic] = [notonaskharabic-Bold-Italic] [features=3Dfea] > \stoptypescript >=20 > \starttypescript [notonaskharabic] > \definetypeface [notonaskharabic] [rm] [serif] [notonaskharabic] = [default] > \stoptypescript >=20 > \usetypescript[notonaskharabic] >=20 > \setupbodyfont [RomanFont] > =20 >=20 > \starttext >=20 > \startMPcode >=20 > picture p[]; > path bb; %bounding box >=20 > z0 =3D (0,0); =20 > z1 =3D (60,40); > z2 =3D (40,90);=20 > z3 =3D (10,70); > z4 =3D (30,50); > z5 =3D (90,70); > z6 =3D (-10,70); >=20 > path A; A =3D z0..z1..z2..z3..z4 ; > pair AStartPoint; AStartPoint =3D point 0 of A; > pair AEndPoint; AEndPoint =3D point 4 of A; > path B; B =3D z5..z6; > pair BStartPoint; BStartPoint =3D point 0 of B; > pair BEndPoint; BEndPoint =3D point 1 of B; > path C; C =3D AStartPoint..AEndPoint; >=20 > % drawing steps: =20 > p1:=3Dimage( > draw A withcolor red; > ); >=20 > p2:=3Dimage( > label(textext("\JapaneseFont =E6=97=A5=E6=9C=AC=E8=AA=9E"), = AEndPoint); > ); >=20 > p3:=3Dimage( > label(textext("\notonaskharabic \textdir TRT =D8=AF=D8=A7=D9=86=DA=AF= ") scaled 1.2, AStartPoint); > ); >=20 > p4:=3Dimage( > label(textext("\KoreanFont =ED=95=9C=EA=B5=AD=EC=96=B4"), = BStartPoint); > ); >=20 > p5:=3Dimage( > label(textext("\RomanFont b=C4=81ng"), BEndPoint); > draw C withcolor green; > ); >=20 > p6:=3Dimage( > draw B withcolor blue; > ); >=20 >=20 > beginfig(0); %% the whole picture for the common bbox > for k=3D1 upto 6: draw p[k]; endfor > bb:=3Dbbox(currentpicture); > endfig; > =20 > for $=3D1 upto 6: > beginfig($); > for k=3D1 upto $: draw p[k]; endfor > setbounds currentpicture to bb; > endfig; > endfor > =20 > \stopMPcode > \stoptext >=20 >=20 > = __________________________________________________________________________= _________ > If your question is of interest to others as well, please add an entry = to the Wiki! >=20 > 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 > = __________________________________________________________________________= _________ --Apple-Mail=_1FA45C3D-8306-4A5C-A1F3-136D8D98D3D1 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi,

It is fun fact very easy to = do. You just use \startMPpage (=E2=80=A6) \stopMPpage multiple times. = Here is an example which build an animation of a particle moving = according to a Brownian = motion. 

Fabrice.

%= 8< = -----------------------------------------------

<= div>\usecolors[crayola]
\setupMPinstance

\starttext

% We can put in the inclusions the = material we will use at each page, to declare things only one = time.
\startMPinclusions
 % the frame of the = video ;
 path TheFrame ;
 TheFrame :=3D = fullsquare scaled 5in ;

 randomseed :=3D = 53 ;
 path TheBrownianMotion ;
 pair = Coordinate[];
 Coordinate[0] :=3D = (0,0);
 TheBrownianMotion :=3D Coordinate[0] = ;
 variance :=3D 10 = ;
\stopMPinclusions

\dorecurse{600}{ = % Frame

\setupMPpage[background=3Dcolor, = backgroundcolor=3DSpringGreen]
\startMPpage[pagestate=3Dstart]

 currentime :=3D #1 ;
 % = Just for learning :
 draw TheFrame withpen pencircle = scaled .1in withcolor magenta ;
 draw = textext("T=3D"&decimal(currentime)) scaled 2 shifted(0,2in) = withcolor magenta ;

Coordinate[currentime] :=3D = Coordinate[currentime-1] + = %(normaldeviate*variance,normaldeviate*variance) ;
  = ((uniformdeviate(1)-0.5)*variance,(uniformdeviate(1)-0.5)*variance) = ;
TheBrownianMotion :=3D for p=3D0 upto (currentime-1) = :
  Coordinate[p] .. endfor Coordinate[currentime] = ;

draw TheBrownianMotion withpen pencircle = scaled .01in withcolor blue ;
draw Coordinate[currentime] = withpen pencircle scaled .10in withcolor red = ;

setbounds currentpicture to TheFrame = ;

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

\stopMPpage


\stoptext
% 8< = -----------------------------------------------

=


Le 27 nov. 2023 = =C3=A0 13:49, Emanuel Han via ntg-context <ntg-context@ntg.nl> a = =C3=A9crit :

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/mpt= opdf-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]
 [m= ode=3Dnode,language=3Ddflt,script=3Darab,
  = init=3Dyes,
  medi=3Dyes,
  = fina=3Dyes,
  isol=3Dyes,
  = calt=3Dyes,
  rlig=3Dyes,
  = tlig=3Dyes,
  trep=3Dyes,
  = curs=3Dyes,
  kern=3Dyes,
  = mark=3Dyes
]

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

\starttypescript = [serif] = [notonaskharabic]
 \usetypescript[serif][fallback]
 \definefontsynonym = [Serif]           &= nbsp;           = [notonaskharabic-Light]       = [features=3Dfea]
 \definefontsynonym = [SerifItalic]          &= nbsp;      = [notonaskharabic-Italic]      = [features=3Dfea]
 \definefontsynonym = [SerifBold]          &nb= sp;        = [notonaskharabic-Bold]        = [features=3Dfea]
 \definefontsynonym = [SerifBoldItalic]         &nb= sp;   [notonaskharabic-Bold-Italic] = [features=3Dfea]
\stoptypescript

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

\usetypescript[notonaskharabic]
\setupbodyfont [RomanFont]
    =

\starttext

\startMPcode

picture= p[];
path bb; %bounding box

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

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

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

p2:=3Dimage(
    = label(textext("\JapaneseFont =E6=97=A5=E6=9C=AC=E8=AA=9E"), = AEndPoint);
);

p3:=3Dimage(
  =   label(textext("\notonaskharabic \textdir TRT =D8=AF=D8=A7=D9=86=DA=AF= ") scaled 1.2, = AStartPoint);
);

p4:=3Dimage(
 &nbs= p;  label(textext("\KoreanFont =ED=95=9C=EA=B5=AD=EC=96=B4"), = BStartPoint);
);

p5:=3Dimage(
 &nbs= p;  label(textext("\RomanFont b=C4=81ng"), = BEndPoint);
    draw C withcolor = green;
);

p6:=3Dimage(
   = ; draw B withcolor blue;
);


beginfig(0); %% = the whole picture for the common bbox
for k=3D1 upto 6: draw = p[k]; = endfor
bb:=3Dbbox(currentpicture);
endfig;
&= nbsp;
for $=3D1 upto 6:
beginfig($);
= for k=3D1 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
________________________________________= ___________________________________________
= --Apple-Mail=_1FA45C3D-8306-4A5C-A1F3-136D8D98D3D1-- --===============1609599315564928773== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1609599315564928773==--