tags:

views:

123

answers:

2

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.

+1  A: 

Found it, needed to do a negative of the rotation (so if it was rotation 90 degrees, it then needs to be rotated -90 degrees)

Needed the following:

 rot neg rotate

So the function becomes:

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

   rot neg rotate
} def
Mrgreen
+1  A: 

The rotate command in Postscript rotates the entire coordinate space, not an individual drawing operation. 90 rotate puts all further operations off the top of the sheet.

msw