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_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 4121 invoked from network); 27 Nov 2023 18:55:16 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 27 Nov 2023 18:55:16 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 79467483AB4 for ; Mon, 27 Nov 2023 19:52:28 +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 ZiK7zj760xf4 for ; Mon, 27 Nov 2023 19:52:27 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 25C14483E8E for ; Mon, 27 Nov 2023 19:50:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id A4CAB483A31 for ; Mon, 27 Nov 2023 19:49:28 +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 lKRSdtuYhnFM for ; Mon, 27 Nov 2023 19:49:27 +0100 (CET) Received: from outbound00.knthost.com (outbound00.knthost.com [45.13.66.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 8B5A5483A2F for ; Mon, 27 Nov 2023 19:49:27 +0100 (CET) Date: Mon, 27 Nov 2023 19:49:17 +0100 DKIM-Filter: OpenDKIM Filter v2.10.3 outbound00.knthost.com 2EDB1F081D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=labonneheure.ch; s=default; t=1701110901; bh=HCg6yzUVbPZ2jA8e4/MqPXS6oQmcQi0opBl0c1DLC/w=; h=Date:From:To:Subject; b=iNLhN3paIuhgCyCoRzpzax1OULAvkvJOogL4b3UuTloWoUwGFsp4J2jpfsourASdO PwbG8rAqbUnRu3jRsOgE/LQGYArnIMf7FLZLRXqGGxgYezsHHVnL0YpCzsqdx9UDCW WUY7b3mozV2m72eEbM+YiyfYsSih2NJj94iZz24jW/duxBL77PKFBPuxsdC88OdzKW h3KhGJhTZucxeX8lsoUZ17V6I0vVYHdHrZIEqvjRFxgLZlNtJiaSdKFUCK5fqaloon kGsp2IXulvL7oUGc48B/SazznNT+0OmMveIh98cb3Lz9UfnKe5MUO52jWF1pS5LodJ ekisEdiHABV1g== To: "=?utf-8?Q?ntg-context=40ntg.nl?=" Message-ID: X-Mailer: Mailspring MIME-Version: 1.0 Message-ID-Hash: AQWB43ILOSWCGOM45NTWXOND2BDGUYIV X-Message-ID-Hash: AQWB43ILOSWCGOM45NTWXOND2BDGUYIV X-MailFrom: emanuel@labonneheure.ch 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] 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: From: Emanuel Han via ntg-context Cc: Emanuel Han Content-Type: multipart/mixed; boundary="===============8058301475053866195==" --===============8058301475053866195== Content-Type: multipart/alternative; boundary="6564e4ad_6b8b4567_3681" --6564e4ad_6b8b4567_3681 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline How can I achieve multipage metapost output from ConTeXt=3F The result sh= ould be a multipage pdf. It contains just a metapost graphic per page. Th= e 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 previo= us pages. I can manage when it is not possible to remove elements (in tha= t 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-i= s-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 Roma= n script: Thanks to ConTeXt, I can define appropriate fonts for each scri= pt. All this works already in my working example. The only unsolved problem is to ship out multiple pages. =46or 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 gra= phic 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 impleme= nted here (because I don't know how that would be done). If each of the f= igures 1 to 6 of my mwe can be put alone on a page, I'd be already very h= appy. 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 view= er and skipped forward and backward from page to page (that is from drawi= ng step to drawing step). mwe: =5Cenableregime=5Butf=5D % enable unicoded input =5Cdefinefontfamily =5BRoman=46ont=5D =5Brm=5D =5Bcalluna=5D =5Cdefinefontfamily =5BKorean=46ont=5D =5Brm=5D =5Bapplemyungjo=5D =5Cdefinefontfamily =5BJapanese=46ont=5D =5Brm=5D =5Bhannotatesc=5D =5Cdefinefontfeature =5Bfea=5D =5Bmode=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 =5D =5Cstarttypescript =5Bserif=5D =5Bnotonaskharabic=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Light=5D =5Bname:notonaskharabic=5D= =5Bfeatures=3Dfea=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Bold=5D =5Bname:notonaskharabic=5D= =5Bfeatures=3Dfea=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Italic=5D =5Bname:notonaskharabic= =5D =5Bfeatures=3Dfea=5D =5Cdefinefontsynonym =5Bnotonaskharabic-Bold-Italic=5D =5Bname:notonaskha= rabic=5D =5Bfeatures=3Dfea=5D =5Cstoptypescript =5Cstarttypescript =5Bserif=5D =5Bnotonaskharabic=5D =5Cusetypescript=5Bserif=5D=5Bfallback=5D =5Cdefinefontsynonym =5BSerif=5D =5Bnotonaskharabic-Light=5D =5Bfeatures=3D= fea=5D =5Cdefinefontsynonym =5BSerifItalic=5D =5Bnotonaskharabic-Italic=5D =5Bfe= atures=3Dfea=5D =5Cdefinefontsynonym =5BSerifBold=5D =5Bnotonaskharabic-Bold=5D =5Bfeatur= es=3Dfea=5D =5Cdefinefontsynonym =5BSerifBoldItalic=5D =5Bnotonaskharabic-Bold-Italic= =5D =5Bfeatures=3Dfea=5D =5Cstoptypescript =5Cstarttypescript =5Bnotonaskharabic=5D =5Cdefinetypeface =5Bnotonaskharabic=5D =5Brm=5D =5Bserif=5D =5Bnotonaskh= arabic=5D =5Bdefault=5D =5Cstoptypescript =5Cusetypescript=5Bnotonaskharabic=5D =5Csetupbodyfont =5BRoman=46ont=5D =5Cstarttext =5CstartMPcode picture p=5B=5D; 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(=22=5CJapanese=46ont =E6=97=A5=E6=9C=AC=E8=AA=9E=22), AEndP= oint); ); p3:=3Dimage( label(textext(=22=5Cnotonaskharabic =5Ctextdir TRT =D8=AF=D8=A7=D9=86=DA=AF= =22) scaled 1.2, AStartPoint); ); p4:=3Dimage( label(textext(=22=5CKorean=46ont =ED=95=9C=EA=B5=AD=EC=96=B4=22), BStartP= oint); ); p5:=3Dimage( label(textext(=22=5CRoman=46ont b=C4=81ng=22), 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=5Bk=5D; endfor bb:=3Dbbox(currentpicture); endfig; for =24=3D1 upto 6: beginfig(=24); for k=3D1 upto =24: draw p=5Bk=5D; endfor setbounds currentpicture to bb; endfig; endfor =5CstopMPcode =5Cstoptext --6564e4ad_6b8b4567_3681 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
How can I achieve multipage metapost output from ConTeXt=3F The resu= lt should be a multipage pdf. It contains just a metapost graphic per pag= e. 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 p= revious pages. I can manage when it is not possible to remove elements (i= n that case I'll just cover them with a covering element).

I saw that it is possible to achieve my goal with standalone metapost, a= s 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 wo= rking example.

The only unsolved problem is to ship out mu= ltiple pages.

=46or the minimal working example, I didn't r= emove the font defining part, because having 4 different fonts is a condi= tion of my use case. The graphic on the other hand is some simple dummy n= onsense graphic not from my project. The graphic is in the provided examp= le 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 woul= d 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 a= ll on the same single page, also on top of figure 0.

The d= esired multipage pdf will be used in presentation mode of a pdf viewer an= d skipped forward and backward from page to page (that is from drawing st= ep to drawing step).

mwe:

=5Cenableregime=5B= utf=5D % enable unicoded input

=5Cdefinefontfamily =5BRoman= =46ont=5D =5Brm=5D =5Bcalluna=5D

=5Cdefinefontfamily =5BKo= rean=46ont=5D =5Brm=5D =5Bapplemyungjo=5D

=5Cdefinefontfami= ly =5BJapanese=46ont=5D =5Brm=5D =5Bhannotatesc=5D

=5Cdefi= nefontfeature
 =5Bfea=5D
 =5Bmode=3Dnode,la= nguage=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
=5D
=5Cstarttypescript =5Bserif=5D =5Bnotonaskharabic=5D
=  =5Cdefinefontsynonym =5Bnotonaskharabic-Light=5D   &= nbsp;   =5Bname:notonaskharabic=5D     = ;   =5Bfeatures=3Dfea=5D
 =5Cdefinefontsynonym =5B= notonaskharabic-Bold=5D        =5Bname= :notonaskharabic=5D        =5Bfeatures= =3Dfea=5D
 =5Cdefinefontsynonym =5Bnotonaskharabic-Italic=5D=       =5Bname:notonaskharabic=5D  &nbs= p;     =5Bfeatures=3Dfea=5D
 =5Cdefine= fontsynonym =5Bnotonaskharabic-Bold-Italic=5D =5Bname:notonaskharabic=5D&= nbsp;       =5Bfeatures=3Dfea=5D
= =5Cstoptypescript

=5Cstarttypescript =5Bserif=5D =5Bnotonas= kharabic=5D
 =5Cusetypescript=5Bserif=5D=5Bfallback=5D
 =5Cdefinefontsynonym =5BSerif=5D    &nbs= p;            = ;      =5Bnotonaskharabic-Light=5D  &n= bsp;    =5Bfeatures=3Dfea=5D
 =5Cdefinefont= synonym =5BSerifItalic=5D        =          =5Bnotonaskharabic-Itali= c=5D      =5Bfeatures=3Dfea=5D
 =5C= definefontsynonym =5BSerifBold=5D      &nbs= p;            =5Bn= otonaskharabic-Bold=5D        =5Bfeatu= res=3Dfea=5D
 =5Cdefinefontsynonym =5BSerifBoldItalic=5D&n= bsp;            =5B= notonaskharabic-Bold-Italic=5D =5Bfeatures=3Dfea=5D
=5Cstoptype= script

=5Cstarttypescript =5Bnotonaskharabic=5D
&= nbsp; =5Cdefinetypeface =5Bnotonaskharabic=5D =5Brm=5D =5Bserif=5D =5Bnot= onaskharabic=5D =5Bdefault=5D
=5Cstoptypescript

= =5Cusetypescript=5Bnotonaskharabic=5D

=5Csetupbodyfont =5BR= oman=46ont=5D
   

=5Cstarttext
=5CstartMPcode

picture p=5B=5D;
path = bb; %bounding box

 z0 =3D (0,0);   
 z1 =3D (60,40);
 z2 =3D (40,90); 
 z3 =3D (10,70);
 z4 =3D (30,50);
&nb= sp;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;<= /div>
path C; C =3D AStartPoint..AEndPoint;

% drawing = steps:       
p1:=3Dimage(<= /div>
    draw A withcolor red;
);

=
p2:=3Dimage(
    label(textext(=22=5CJapane= se=46ont =E6=97=A5=E6=9C=AC=E8=AA=9E=22), AEndPoint);
);
<= br>
p3:=3Dimage(
    label(textext(=22=5Cnot= onaskharabic =5Ctextdir TRT =D8=AF=D8=A7=D9=86=DA=AF=22) scaled 1.2, ASta= rtPoint);
);

p4:=3Dimage(
  &= nbsp; label(textext(=22=5CKorean=46ont =ED=95=9C=EA=B5=AD=EC=96=B4=22), B= StartPoint);
);

p5:=3Dimage(
 &nbs= p;  label(textext(=22=5CRoman=46ont b=C4=81ng=22), BEndPoint);
=
    draw C withcolor green;
);

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


beginfig(0); %% the whole picture for the common= bbox
for k=3D1 upto 6: draw p=5Bk=5D; endfor
bb:=3Db= box(currentpicture);
endfig;
 
for =24= =3D1 upto 6:
beginfig(=24);
for k=3D1 upto =24: d= raw p=5Bk=5D; endfor
setbounds currentpicture  to bb;
endfig;
endfor
 
=5CstopMPco= de
=5Cstoptext


--6564e4ad_6b8b4567_3681-- --===============8058301475053866195== 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 ___________________________________________________________________________________ --===============8058301475053866195==--