Go to the first, previous, next, last section, table of contents.


A. PostScript Commands

This appendix describes a set of macros for accessing some of the PostScript builtin functions. Each of these macros issues a single PostScript command. The extra services provided by TeXdraw are the interpretation of coordinates in user units relative to the current drawing segment and the writing of a pending TeXdraw move to the PostScript file. This last operation establishes the current point in PostScript. The user of these commands should be familiar with the concepts of path construction and filling in PostScript. Further details on the PostScript functions used can found in the PostScript Language Reference Manual, Second Edition, Adobe Systems, Addison-Wesley, 1990.

These macros are distributed in file `txdps.tex'.

The \PSsetlinecap and \PSsetlinejoin commands control the way line ends and line joins are rendered. The default values set by TeXdraw (round caps and round join) are appropriate for most drawings. Changes to these parameters apply to the current and subsequent paths.

\PSsetlinecap type
Set the line cap parameter. The value 0 gives a butt cap; 1 gives a round cap; and 2 gives a projecting square cap. The initial value is corresponds to a round cap.
\PSsetlinejoin type
Set the line join parameter. The value 0 gives a miter join; 1 gives a round join; and 2 gives a bevel join. The initial value corresponds to a round join.

PostScript paths and fill operations can be controlled by a number of functions. By design, TeXdraw always maintains a defined PostScript current point. Some of the following macros cause the PostScript current point to become undefined. The PostScript current point must be set again (say with a \PSmoveto command) before invoking basic TeXdraw commands.

\PSstroke
Stroke a PostScript path. The current path is stroked with the current gray level (set with \setgray) and the current line pattern (set with \lpatt). The PostScript current point becomes undefined.
\PSnewpath
Establish a new path. The PostScript current point becomes undefined.
\PSclosepath
Close a subpath. A new subpath is started.
\PSfill
Fill a region defined by a path. Each subpath is closed and the enclosed regions painted with the current gray level. The PostScript current point becomes undefined. The gray level can be set with the TeXdraw command \setgray.

The following line commands interpret coordinates relative to the current TeXdraw scaling and drawing segment. The specified coordinate affects the drawing size as determined by TeXdraw.

\PSlineto (x y)
Add a line segment to the current path. This command is identical to the TeXdraw command \lvec. The PostScript current point must be defined before this command is issued.
\PSmoveto (x y)
Move to the coordinate specified by (x y). The PostScript current point becomes defined.

The following macros provide access to the general arc commands in PostScript. The coordinates are interpreted relative to the current TeXdraw scaling and drawing segment. The specified coordinate affects the drawing size as determined by TeXdraw.

\PSarc r:radius sd:start-angle ed:end-angle (x y)
Draw a counterclockwise arc. The center of the arc is at the given position. The radius is specified by radius. The start and end angles (in degrees) are specified by start-angle and end-angle. If the PostScript current point is defined, this command also draws the line from the current point to the beginning of the arc. The line and arc become part of the current path. The current point becomes defined.
\PSarcn r:radius sd:start-angle ed:end-angle (x y)
Draw a clockwise arc. The center of the arc is at the given position. The radius is specified by radius. The start and end angles (in degrees) are specified by start-angle and end-angle. If the PostScript current point is defined, this command also draws the line from the current point to the beginning of the arc. The line and arc become part of the current path. The current point becomes defined.

The macro \writeps provides the general facility to write arbitrary PostScript commands to the PostScript file. This macro is used by the preceding commands and by the TeXdraw commands themselves. This facility has to be used with care since changes in position or scaling resulting from the PostScript commands are not known to TeXdraw.

\writeps {<ps-commands>}
Write PostScript commands to the intermediate PostScript file. Before the commands are inserted, any pending TeXdraw move is written to the PostScript file. The PostScript scaling gives 300 units/inch.


Go to the first, previous, next, last section, table of contents.