[tlbuild] Fwd: Compatibility with ConTeXt was broken in asy 2.33

John Bowman bowman at ualberta.ca
Wed May 20 03:35:35 CEST 2015


Ok, I've just released Asymptote 2.35 to work around this ghostscript
eps2write bug.
Under MSWindows 7, I noticed an eps2write I/O warning with xelatex and
ghostscript 9.15
but this went away when I upgraded to ghostscript 9.16.

I would recommend recompiling asy on all platforms to support XeLaTeX and
ConTeXt users.

-- John

---------- Forwarded message ----------
From: John Bowman <bowman at ualberta.ca>
Date: Tue, May 19, 2015 at 4:21 PM
Subject: Re: Compatibility with ConTeXt was broken in asy 2.33
To: Mojca Miklavec <mojca.miklavec.lists at gmail.com>


Hi Mojca,
Ok, the work around is implemented in svn r5717. I will release this as asy
2.35.
I've also updated the asy installation instructions under MacOS, referring
to MacPorts.
It's good to see that  you are the maintainer. :-)

Regards,

-- John

Index: runlabel.in
===================================================================
--- runlabel.in (revision 5716)
+++ runlabel.in (revision 5717)
@@ -293,6 +293,8 @@
   int status=opentex(texname,prefix,!xe);

   string pdfname,pdfname2,psname2;
+  bool keep=getSetting<bool>("keep");
+
   if(!status) {
     if(xe) {
       pdfname=auxname(prefix,"pdf");
@@ -324,12 +326,20 @@
         cmd.push_back("-dBATCH");
         if(safe) cmd.push_back("-dSAFER");
         cmd.push_back("-sDEVICE=eps2write");
-        cmd.push_back("-sOutputFile="+psname2);
+        // Work around eps2write bug that forces all postscript to first
page.
+        cmd.push_back("-sOutputFile="+psname2+"%d");
         cmd.push_back(pdfname2);
         status=System(cmd,0,true,"gs");

-        std::ifstream in(psname2.c_str(),std::ios::binary);
-        ps << in.rdbuf();
+        for(unsigned int i=1; i <= n ; ++i) {
+          ostringstream buf;
+          buf << psname2.c_str() << i;
+          const char *name=buf.str().c_str();
+          std::ifstream in(name,std::ios::binary);
+          ps << in.rdbuf();
+          ps << "(>\n) print flush\n";
+          if(!keep) unlink(name);
+        }
         ps.close();
       }
     } else {
@@ -350,7 +360,6 @@
   if(status != 0)
     error("texpath failed");

-  bool keep=getSetting<bool>("keep");
   if(!keep) { // Delete temporary files.
     unlink(texname.c_str());
     if(!getSetting<bool>("keepaux"))
@@ -359,12 +368,12 @@
     if(xe) {
       unlink(pdfname.c_str());
       unlink(pdfname2.c_str());
-      unlink(psname2.c_str());
     } else
       unlink(dviname.c_str());
     if(settings::context(texengine)) {
       unlink(auxname(prefix,"top").c_str());
       unlink(auxname(prefix,"tua").c_str());
+      unlink(auxname(prefix,"tuc").c_str());
       unlink(auxname(prefix,"tui").c_str());
     }
   }


On Tue, May 19, 2015 at 5:29 AM, John Bowman <bowman at ualberta.ca> wrote:

> Hi Mojca,
> Thanks for reporting this issue, which I tracked down to a bug in the new
> Ghostscript eps2write driver that causes all multipage output to appear on
> page 1. This effects both the xelatex and context texengines in Asymptote.
>
> A workaround seems to be to force each page to go to a separate file
> (using %d in the filename). I should have a fix implemented later today.
>
> Attached is a minimal example. Each label belongs to a separate page. The
> generated file gsbug__.pdf is correct but gsbug__.ps, produced by
>
> gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=eps2write
> -sOutputFile=gsbug__.ps gsbug__.pdf
>
> contains 2 pages but all of the postscript now appears only on page 1.
>
> This needs to be reported to the ghostscript maintainers, but in the
> meantime we need a workaround since ghostscript 9.15 and 9.16 are now
> widely in use.
>
> -- John
>
>
>
> On Tue, May 19, 2015 at 12:36 AM, Mojca Miklavec <
> mojca.miklavec.lists at gmail.com> wrote:
>
>> Dear John,
>>
>> On Mon, May 18, 2015 at 10:06 PM, John Bowman wrote:
>> > Hi Mojca,
>> >
>> > The change to support rendered 3D context images is easy. In adding
>> support
>> > for eps2write,
>> > I didn't worry about supporting 3D context labels since context doesn't
>> > support vector 3D graphics anyway (it doesn't support embedded PRC
>> content).
>>
>> ConTeXt supports PRC by now (or at least I think it does), but we
>> won't have time to add support for it in time for TL 2015 anyway, so
>> true, no need to worry about true 3D.
>>
>> > But as I believe you are pointing out, some context users may be happy
>> just
>> > to have a rendered preview image.
>>
>> Actually this is all that is needed for printed materials.
>>
>> In all honesty I could have certainly used another engine, but I'm
>> more comfortable and familiar doing the font setup in ConTeXt.
>>
>> > The patch below (snv r5715) tells asy to
>> > treat context just like xe (these are special cases because they do not
>> > provide dvi output). I tested this with the context from TL 2014 and it
>> > seems to work as desired.
>>
>> Yes, it works better now, but some things still break. I will send the
>> source code and some logs off-list.
>>
>> In short:
>>
>> [context runs succesfully]
>> system          | total runtime: 1.508 seconds
>> gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite
>> -sOutputFile=cylinder__.pdf cylinder_.pdf
>> gs -q -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=eps2write
>> -sOutputFile=cylinder__.ps cylinder__.pdf
>> gs -q -dBATCH -P -dSAFER -sDEVICE=eps2write -sOutputFile=/dev/null
>> cylinder_.ps
>> M 0.00146484 -0.000244141L -35.6001 -0.000244141L ...
>> [really looooooong list of coordinates in a single line]
>> ... -17.0898 148.609 -14.0703 150.828 -13.1211 151.703cM -17.0898 148.609
>> /opt/local/share/asymptote/plain_Label.asy: 670.23: reading array of
>> length 1 with out-of-bounds index 1
>>
>> Mojca
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/tlbuild/attachments/20150519/98eef07a/attachment-0001.html>


More information about the tlbuild mailing list