rapatel@khnphwzhn.njin.net (Rocky - Rakesh Patel) (02/27/90)
There are some serious bugs with printing and insets... When embedded rasters are incuded in a document, ezprint ends up sticking `\` at the end of each postscript command. That is a serious problem. psdit from Transcript, recognizes all code between a '%' and a '.' on a line by itself to be embedded postscript. However, since ezprint generates a '\' at the end of each line of the postscript code, it ends with a `.\'. This causes psdit to assume the following ditroff output code to be postscript. That really is a bug with ezprint - not psdit. Those '\'s shouldn't be added unless it is part of the valid postscript code. The other problem is seen when embedding other insets into a zip object. For example: [An Andrew ToolKit view (a drawing) was included here, but could not be displayed.] Results in the following code from ezprint (ezprint -t) : .so /usr/local/andrew/lib/tmac/tmac.atk .IZ .nr IN 36p .nr LT 432p .nr PO 54p .br .ad b 'ft R .nr PS 12 .ps \n(PS .nr VS 14p .vs \n(VSu .nr EN 8n .sp 0.5i .nr DP 0 .ds Fn \fR .ds HF R .nr HS \n(.s .ds FF R .nr FS \n(.s .RS .nh .OC 'PB 586 413 'if \n(zT \{\ \! 586 troffadjust 413 neg translate \!%!PS-Adobe-2.0 EPSF-1.2 \!% Begin Zip PostScript Prelude Version 0.0 \!gsave % Save Environment Around Zip Drawing \!1 -1 scale \!1 setlinewidth 2 setlinejoin \! \!/zip_Rectangle { \! gsave newpath \! 0 setgray /LW exch def /shade exch def \! /B exch def /R exch def /T exch def /L exch def \! L T moveto R T lineto R B lineto L B lineto L T lineto \! shade 0 gt {gsave shade setgray fill grestore} if \! closepath LW 0 gt {LW setlinewidth stroke} if grestore \! }def \!/zip_Round_Rectangle { \! gsave newpath \! 0 setgray /LW exch def /shade exch def \! /YR exch def \! /XR exch def \! /B exch def /R exch def /T exch def /L exch def \! L XR add T moveto \! R T R B XR arcto 4 {pop} repeat \! R B L B XR arcto 4 {pop} repeat \! L B L T XR arcto 4 {pop} repeat \! L T R T XR arcto 4 {pop} repeat \! shade 0 gt {gsave shade setgray fill grestore} if \! closepath LW 0 gt {LW setlinewidth stroke}if grestore \! }def \!/zip_Line { \! 0 setgray /LW exch def moveto lineto LW setlinewidth stroke \! }def \!/zip_Poly_Line { \! newpath 0 setgray \! 2 sub /npoints exch def \! moveto currentpoint \! /lastY exch def /lastX exch def \! 0 1 npoints {pop lineto} for \! lastx lasty lineto \! /lastx lastX def /lasty lastY def \! shade 0 gt {gsave shade setgray fill grestore} if \! LW 0 gt {LW setlinewidth stroke} if \! }def \!/zip_Trapezoid { \! setgray \! moveto 3 {lineto} repeat \! fill 0 setgray \! }def \!/zip_Ellipse { \! moveto /R exch def \! gsave scale \! currentpoint newpath \! R 0 360 arc closepath stroke grestore \! }def \!/zip_Fill_Ellipse { \! moveto /R exch def \! gsave scale \! currentpoint newpath \! R 0 360 arc closepath setgray fill grestore \! }def \!/zip_Center_X { \! stringwidth pop 2 div sx exch sub /sx exch def \! }def \!/zip_Right_X { \! stringwidth pop sx exch sub /sx exch def \! }def \!/zip_Middle_Y { \! 2 div sy exch sub /sy exch def \! }def \!/zip_Bottom_Y { \! sy exch sub /sy exch def \! }def \!% End Zip PostScript Prelude \! \!% Begin Zip Drawing \! 0 -396 translate % Portrait Mode \! /width 586 def /height 413 def % Set Clip Rectangle \! newpath 0 0 moveto \! 0 height lineto width height lineto \! width 0 lineto 0 0 lineto clip newpath \! /lastx 278.24 def /lasty 192.12 def /shade 0.00 def /LW 1 def \! 278.24 192.12 \! 1 zip_Poly_Line \! /Times-BoldItalic findfont 40 scalefont setfont \! gsave 1 -1 scale \! /sx 285.43 def /sy 23.67 neg def \! (Some people don't like fire breathing dragons....) zip_Center_X \! 40 zip_Middle_Y \! sx sy moveto (Some people don't like fire breathing dragons....) show grestore \! gsave % Save Zip Environment Surrounding Imbedded Object \! 0 530 translate 1 -1 scale % Set Zip Imbedded Object Environment /width -1 def /height -1 def /xScale 0.4800 def /yScale 0.4800 def width xScale mul height yScale mul scale /picstr width 7 add 8 idiv string def width height 1 [width 0 0 height neg 0 height] {currentfile picstr readhexstring pop} image \! grestore % Restore Zip Environment Surrounding Imbedded Object \! grestore % Restore Environment Around Zip Drawing \! % End Zip Drawing \} 'PE 586 413 .TA Notice that the embedded raster's postscript is not quoted with '\!', and that the raster's data for the image operator is non-existent. When feeding this code through ditroff, we end up with the non- quoted postsrcipt being translated as ditroff code of course.... This is a serious mess. I'm surprised no one has bothered to even mention these problems or attempted to fix them. Note that I have been happy with the new release since the folks at CMU (and friends) have put considerable effort in to de-CMUize the release. I just wish we could print the stuff now. :-( I have to set up my format command to strip the extraneous '\'s added after each postscript line, so that normal rasters can print. This problem with insets is a serious mess. I haven't decided yet whether to dive in there and see if I can fix the problem. Has anyone fixed these problems, or taken a good look at them? Rakesh Patel.
jaap+@andrew.cmu.edu (Jaap Akkerhuis) (02/28/90)
Excerpts from internet.info-andrew: 26-Feb-90 Printing bugs with insets. Rocky - Rakesh Patel@khn (5259+1) > There are some serious bugs with printing and insets... > When embedded rasters are incuded in a document, ezprint ends up > sticking `\` at the end of each postscript command. That is a serious problem. Well, it is not a problem of ezprint. It is a problem what pops up in newer versions of troff (As far as I've have seen, in ditroff release 2.0). This newer version of troff has a bug fix which cause this new one introduce a bug, the classical example of ``there is always one last bug''. For historical reasons ditroff has its own version of the stdio library. It has been decided that [fs]printf will always stick a backslash before non-printable characters, although this code actually never got executed in the original ditroff version. This bug is fixed and now another one pops up: accidently '\n' is also considered non-printable. The problem can easy be demonstrated with something along the line of: troff \!this string will appear in the ouput with a backslash attached \!it shouldn't .ex There should now be some output with the two strings clearly visible and with a backslash before the CR following these strings. If you have the source, it is easy to fix. Look at the file n1.c and look at the scaled down version of C library printf. You will see twice code in the style of: else if (c == 'c') { c = *astr & 0377; if (c > 0177 || c < 040) putchar('\\'); putchar(*astr & 0177); etc. It is obvious that one should not print the backslash for certain chars < 040, so the code need to look along the lines of: else if (c == 'c') { c = *astr & 0377; switch(c) { case '\n': case '\t': case '\f': case '\b': putchar(c); break; default: if (c > 0177 || c < 040) putchar('\\'); putchar(*astr & 0177); } etc. Note that I'm doing this from memory, so you mileage might vary how the code actually looks like. Of course, if you don't have the source yell to your supplier. > The other problem is seen when embedding other insets into a zip object. [Example deleted] > This is a serious mess. I'm surprised no one has bothered to even mention > these problems or attempted to fix them. Note that I have been happy > with the new release since the folks at CMU (and friends) have put considerable > effort in to de-CMUize the release. I just wish we could print the stuff > now. :-( Yep, it is a serious mess. Printing is not ATK strongest point. It is of course difficult to put this infinite embedding of objects on paper. It is amazing how much does work and yes, I'm afraid embedding insets in zip looses when it gets printed.
janssen@parc.xerox.com (Bill Janssen) (03/01/90)
Thanks. I fixed my ditroff, and now printing of rasters and zips works just fine! There are still a couple of problems that spring to mind with table and eq. I'll post more to andrew-bugs. Bill