gsave … grestore

To keep that string from affecting the path of the line, save the graphics state with a gsave command before showing the string. Then, restore it with grestore before the next lineto:

%!PS
0 0 moveto 306 396 lineto
% CURRENT POINT IS 306 396
gsave
/Helvetica 10 selectfont
(the effect of showing this string is isolated) show
% CURRENT POINT IS AT END OF STRING (306+? 396)
grestore
% CURRENT POINT IS AT BEGIN OF STRING (306 396)
612 792 lineto
stroke
showpage % END OF PROGRAM

gsavegrestore

Get it? The current point (within the graphics state) at the end of the first line is saved to be used by the start of the second line. The effect of changing the current point by showing the string is thus negated.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s