Rotating text in postscript

Posted by Mrgreen on Stack Overflow See other posts from Stack Overflow or by Mrgreen
Published on 2010-03-17T01:58:33Z Indexed on 2010/03/17 2:01 UTC
Read the original article Hit count: 374

Filed under:

I have the following postscript code:

/outputtext {
   /data exch def
   /rot exch def
   /xfont exch def
   /Times-Roman findfont
   xfont scalefont
   setfont
   /y1 exch def
   /x1 exch def
   x1 y1 moveto
   rot rotate
   data show
} def


% x y fontsize rotation (text) outputtext
20 300 12 0 (text1) outputtext
20 400 12 90 (text2) outputtext
20 500 12 90 (text3) outputtext
20 600 12 0 (text4) outputtext
showpage

The function simply outputs text based on a x, y co-ords and the text to display, there is also a variable for rotation. For some reason when I output text with a rotation of >0 degrees, all other text that comes after that will not work, I can't seem to figure out why this is the case. In the example above, 'text1' and 'text2' will display, but not 3 and 4.

© Stack Overflow or respective owner

Related posts about postscript