Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Postscript code question

2 views
Skip to first unread message

Typocrates

unread,
Mar 9, 2010, 7:24:40 PM3/9/10
to
Hello
I am experimenting with MetaPost and GSView is not displaying the
following file correctly (the second line is not displayed) while
Adobe Illustrator shows both lines. GSView version 4.9, Ghost, GPL
Ghostscript 8.71.

%!PS
newpath -28 -28 moveto
28 28 lineto stroke
newpath 28 -28 moveto
-28 28 lineto stroke
showpage
%%EOF


Thank you.

Dan Coby

unread,
Mar 9, 2010, 8:14:19 PM3/9/10
to

Please remember that the default coordinate space for a Postscript
page has the origin (0, 0) at the lower left corner of the page.

The negative coordinates that you are using are outside of the page
boundaries. As a result you are only seeing half of your first line.
The second line is totally off of the page except for crossing through
the origin. Thus it only creates a dot at the origin (which is already
marked by the first line).

Add

50 50 translate

to the start of your test file to shift the origin and then you will be
able to see both lines.

Dan

Typocrates

unread,
Mar 9, 2010, 9:06:43 PM3/9/10
to

You are absolutely right! For example, the following does not get
displayed. The files appear just fine when I include them in a TeX
file but GSView does not display when I use negative coordinates as
you correctly said. Maybe GSView is not respecting the BoundingBox?

%!PS
%%BoundingBox: -11 -11 1 1
%%HiResBoundingBox: -10.25 -10.25 0.25 0.25
%%Creator: MetaPost 1.005
%%CreationDate: 2010.03.10:0400
%%Pages: 1
%%BeginProlog
%%EndProlog
%%Page: 1 1
0 0 0 setrgbcolor 0 0.5 dtransform truncate idtransform setlinewidth
pop
[] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit
newpath -10 -10 moveto
0 0 lineto stroke
showpage
%%EOF

xymarkd

unread,
Mar 10, 2010, 12:43:19 PM3/10/10
to
> %%EOF- Hide quoted text -
>
> - Show quoted text -

%%BoundingBox is merely a comment, not a command to the PostScript
engine, so GSView ignores it. It's there so that documents that
include this page can know where the content is drawn and relocate it,
scale it, etc., as desired in the enclosing page. That is how TeX
knows what's there, how big it is, and how to move it to make the
bounded part visible.

-Mark DeVries
SDL

0 new messages