fixing /invalidfont in ghostscript

Recently I updated ghostscript, and it stopped working even on its own examples:

$ pwd
$ ps2pdf ~/a.pdf
ERROR: /invalidfont in findfont
Operand stack:
   (Palatino-Italic)   Font   (Palatino-Italic)   228176   (Palatino-
   Italic)   --nostringval--   (Palatino-Italic)   URWPalladioL-Ital
   Times-Italic   NimbusRomNo9L-ReguItal
Execution stack:

It seems there is some problem with fonts and search path. Probably, something is updated in the algorithm. I didn’t have a lot of time to find what’s wrong, so I implemented a quick fix.

First I run:

strace -o ~/gvtr ps2pdf ~/a.pdf

This command produced a trace file of executing “ps2pdf”. I searched for “pfb” (an extension for Type1 fonts), and the first match was “p052023l.pfb”. The program was unable to find this file. The file exists on the file system:

$ find /usr/share/fonts/ -name 'p052023l.pfb'

After thinking on the output from “gs -h”, the section “Search path”, I made a quick dirty fix, but it works for me:

# pwd
# ln -s /usr/share/fonts/default/Type1 fonts

One Response to “fixing /invalidfont in ghostscript”

  1. chrelad Says:

    I was having this same problem, and tried your solution. Didn’t work, but it was a good suggestion.

    In my case, I was trying to compile xtrans from the xorg GIT repo. It was failing because ghost-script was dying with the aforementioned error, so finally I just blanked out the file and everything compiled fine. No documentation, but I’m not a developer so I don’t really mind :)

    > # Worked for me!

Leave a Reply