PostScript Question: Exch and dictionaries

Joel Hammer joel
Tue Sep 18 22:10:28 PDT 2007


I am trying to figure out dictionaries in Postscript.

Hard to find anything simple enuf for me.

Here is an example of a dictionary in Thinking in
Postscript. I don't see what use this dictionary is. I
can't figure out what the use is of X, Y and text. They
are just defined as exch.  That does nothing, I think,
but exchange the top two items on the stack. So, what good
does that do twice in a row. Just "moveto show" would seem
to accomplish what you want.

And, when I try this code, I get a stack underflow error,
of course, leaving the string on the stack.

Any pointers appreciated.


/LOCAL 5 dict def % one dictionary used by all procedures
/Text % (string) Xloc Yloc Text - 
{ %def
LOCAL begin
/X exch def
/Y exch def
/text exch def
X Y moveto text show
end
} bind def


Joel



More information about the Linux-users mailing list