Current Page:
Current Path:
Clipping Path:
Positions on the POSTSCRIPT current page are described in terms
of a user coordinate system or user space.
The POSTSCRIPT user space can be altered in three ways. The
coordinate system’s origin may be translated, moved to any
point in user space. The axes may be rotated to any orientation.
The axes may be scaled to any degree desired;
Note that spaces, tabs, and newline characters act as delimiters of
POSTSCRIPT objects. Other characters, such as parentheses and
brackets, can be delimiters under some circumstances;
top two numbers from the stack, add them, and leave the sum on
the stack.
-27 neg Þ 27
25 3 idiv Þ 8
Thus, if the top item on the stack was
a dictionary (we shall be talking about this at greater length
later), the == operator would print
––dictionary––
on the terminal.
Another useful interactive stack operator is pstack. This operator
prints the contents of the entire stack. Unlike the == operator,
pstack does not remove any of the stack’s contents.
We start out by calling the newpath operator. This operator
empties the current path and declares we are starting a new path.
Note that the lineto operator does not actually draw on the current
page. It simply adds a line segment to the current path. You
may later draw in this line, but it does not happen automatically.
The
closepath operator adds a line segment to the current path connecting
the current point to the last point addressed by a moveto
operator. It closes the path with a mitered join, eliminating the
notch we noticed in our first box. It is possible to change the
method by which POSTSCRIPT joins line segments;
Note that each box had to start with a moveto. This is because the fill operator clears the current path; after a fill, there is no
current point and a lineto or rlineto would have no starting
point. The stroke operator also clears the current path.
To change the value of a variable, you redefine it with a new
value.
findfont looks up the name in a dictionary called FontDirectory
and places the appropriate font dictionary on the stack.
stringwidth takes a string from the top of the stack and replaces
it with the horizontal and vertical distances the current point
would be moved if the string were shown in the current font. The
y offset is left on top of the stack, with x below it. Thus, the line
above duplicates the string on the stack, replaces the top copy of
the string with the x and y offsets, and then drops the y offset
from the stack. The stack is left with the string’s width on top of
the stack and the string itself below.