Upgrading Ghostscript and CentOS

Posted on July 22, 2010
The installed Ghostscript version on CentOS is usually too old if you compare it to installations like Ubuntu. Upgrading ghostscript without compiling the whole package is a challenge, but I found via Chris Schuld’s Blog a link to the http://blackopsoft.com/ repository which provides a recent ghoscript version.

The Problem

Nevertheless, I still had troubles with ImageMagick. If you want to convert PDFs to images for example, the installed ghostscript version was unable to lookup certain font files resulting in an error similar to this one:
Error: /invalidfont in findfont
Operand stack:
   Arial-ISO   Arial-ISO   Arial   Font   Arial
Execution stack:
   [...]
Dictionary stack:
  [...]
Current allocation mode is local
Last OS error: 2
Current file position is 279
GNU Ghostscript 7.05: Unrecoverable error, exit code 1

The Solution

I hunted around in the system. Apparently ghostscript still uses a fontmap to lookup fonts. The question is which fontmap was in use. I tried to change the fontmap in /etc/ghostscript which had no affect.

I finally found a bogus fontmap under
/usr/share/ghostscript/8.70/Resource/Init
which provided all font entries and aliases, but none of the aliases had a font file associated with it. For example, Helvetica-Bold pointed to NimbusSanL-BoldCond, but NimbusSanL-BoldCond had no pointer to an existing font file in the file system. It was simply missing.

The Fix

I got it now working with this in /usr/share/ghostscript/8.70/Resource/Init:
%!
% See Fontmap.GS for the syntax of real Fontmap files.
%% Replace 1 (Fontmap.GS)
/NimbusSanL-Regu        (n019003l.pfb)  ;
/NimbusSanL-ReguItal    (n019023l.pfb)  ;
/NimbusSanL-Bold        (n019004l.pfb)  ;
/NimbusSanL-BoldItal    (n019024l.pfb)  ;

/NimbusSanL-ReguCond    (n019043l.pfb)  ;
/NimbusSanL-ReguCondItal        (n019063l.pfb)  ;
/NimbusSanL-BoldCond    (n019044l.pfb)  ;
/NimbusSanL-BoldCondItal        (n019064l.pfb)  ;

(Fontmap.GS) .runlibfile
References: