Question

I have script in ps

%!
%% Example 4

/box0{ 
newpath 56 257 moveto 
0 -198 rlineto 
284 0 rlineto 
0 198 rlineto 
-284 0 rlineto 

closepath } def 

/Times-Roman findfont
32 scalefont
setfont


box0
gsave
/test{

(Example 4) true charpath stroke

} def
test
showpage

and it shows square, how can I remove it

Was it helpful?

Solution

The /box0{...} def defines a function which draws a box.

/box0{ newpath 56 257 moveto 0 -198 rlineto 284 0 rlineto 0 198 rlineto
       -284 0 rlineto closepath } def 

The box0 invoked the /box0 function and draws a box, but does not fill it or stroke it, so the path remains part of the currentpath. The closepath connects from the point reached by the -284 0 rlineto which happens to be the starting point 58,257. You then start some text from the baseline of the text, which places the baseline of the text on the top of the box. charpath adds the path of the text onto the path of the box. The stroke strokes both the charpath and the box.

If you don't want the box, remove the box0.

The gsave shouldn't be there or should have a matching grestore.

OTHER TIPS

Presumably removing the call to box0 will remove the square. I take it you didn't code this PostScript program yourself ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top