postscript delegate not finding font

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
hylandp

postscript delegate not finding font

Post by hylandp »

Hi,
I am converting a postscript file to a png with "convert draft.ps -background white -trim +repage draft.png". The process works without error but the truetype font specified in the .ps file is being substituted. However, if I run "gs draft.ps" in the same directory the generated page is correct ie gs queries the system for the font and loads it. I understand convert uses ghostscript as its delegate program for rendering postscript so I presume the issue must be in how convert is managing ghostscript. Can someone point me in a direction to hunt this problem down please?
I am using convert on a Debian Lenny system (64 bit).
Thanks, Pat
hylandp

Re: postscript delegate not finding font (solved)

Post by hylandp »

I managed the sort the issue myself but thanks to anyone who might have considered it. The problem was a combination of the font path and the paranoid delegate management of ghostscript in delegates.xml. The postscript delegate specified in /usr/lib/ImageMagick-6.3.7/config/delegates.xml included (for the pngalpha output device) the option -dPARANOIDSAFER which (it appears??) was preventing ghostscript from querying the operating system for font resources when it did not find the specified font in the ghostscript font path (I had the special fonts I was using in /usr/local/share/fonts/truetype/ which was available through X-windows).
I did not want to modify delegates.xml so I now do the initial ps to png directly with ghostscript "gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r72 -sOutputFile=test.png draft.ps" then do the trim and setting of a white background in a separate operation using convert.
For more info on the ghostscript output devices, I found "http://pages.cs.wisc.edu/~ghost/doc/cvs/Devices.htm" very helpful

Happy now so on to the next problem.
hylandp

Re: postscript delegate not finding font

Post by hylandp »

Another option that also works is to set the GS_FONTPATH environment variable manually when running convert ie (for my case)
GS_FONTPATH=$GS_FONTPATH:/usr/local/share/fonts/truetype/ convert draft.ps draft.png
This has the advantage of running ghostscript in safe mode in case the .ps file is corrupt (or tampered) and you do not want to allow it file access permissions. Cheers.
Post Reply