create blog

go home go home
  1. about
  2. code
  3. wiki
  4. blog

Archive for the ‘PostScript’ Category

Apple Postscript Bug

Sunday, February 1st, 2009

Apple’s OS X has a built-in PostScript RIP (actually, it converts to PDF). There is a bug in it that I found awhile back while creating PostScript output for use in PPML: rotating text in increments of 90° fails. Oddly enough, while 90° fails, 89.999° works.

To try this out, open a text editor like TextEdit, and enter the following:

gsave
72 72 translate 
90 rotate 
/Helvetica findfont 24 scalefont setfont 
0 0 moveto 
(Some Postscript Text) show 
grestore

Save it with a .ps extension, and open it using Preview. The text will not be rotated. If you have Adobe Distiller, try that — the text is rotated.

Now change the 90 to 89.999:

gsave
72 72 translate 
89.999 rotate 
/Helvetica findfont 24 scalefont setfont 
0 0 moveto 
(Some Postscript Text) show 
grestore

It works!

So, to adapt to this problem, I had to add a special case to the PPML output: if the angle would be written as 90, 180, 270, etc., subtract/add .001.

In short, due to a bug in another piece of software, my software has extra code for a workaround hack.