I use a program that produces Postscript and allows use of non-standard Postscript fonts. I wanted to figure out how to get Ghostscript to load those fonts so I could produce a PDF file from the Postscript. Should be simple, eh? Well it took me a week of trolling message boards, studying documentation, and trying things before I figured out what was going on.
Part of the problem was that there are multiple versions of Ghostscript that work differently, and much of the “help” you find with a Google search applies to versions other than the one you are using. I am working with the latest version of Ghostscript (as of 2/9/21), version 9.53.3. If you are using an earlier version, upgrade. If you’re using Ghostscript with some other program that requires a certain early version of Ghostscript, I can’t help. Things have changed a lot with how fonts are loaded.
I’m using Windows 10. It probably works differently on other platforms.
Paths and Directories
There seem to be a lot of directories that Ghostscript looks at. You can see a list by typing “gs -h” (or whatever your Ghostscript executable is) at the command line. Ignore it — I don’t know what Ghostscript looks for in those directories, but it isn’t fonts.
The Fontmap.gs file
If you get deep into this, you’ll eventually come to the conclusion that the key to getting fonts working is the Fontmap file. There are lots of them — the one that’s supposedly used is Init\Fontmap.gs. Ignore it, and don’t change it. It won’t accomplish what you want, even if it seems like it should.
If you really want to try to use the Fontmap file, you’ll find that Ghostscript probably isn’t reading it. To get it to be read, use the
parameter. Use the quotes since there’s a space in the parameter. Use “#” instead of “=” because they say you should.
But take my advice and don’t.
The FONTPATH Parameter
The key to all this is the FONTPATH parameter. It specifies where Ghostscript should look for font files. Ghostscript doesn’t seem to read font files unless you specify this. Once you do, everything will start working.
I suggest that you put all your fonts, regardless of the type, in the Windows Fonts directory. Note that Ghostscript will use Truetype fonts, so all the fonts in the Fonts directory are available to you. But you can add PFB or other Postscript fonts to that directory — they won’t be available to Windows programs but if you have Postscript that references them, they will get used.
To specify the FONTPATH parameter, use the:
parameter. The quotes aren’t needed unless you use a path that has a space in it. The “=” is replaced with a “#” for some reason.
Ghostscript uses the font names in the Postscript you are reading, and tries to match them with font names in the font directory specified in the FONTPATH directory. It doesn’t need the Fontmap file to do this.
Be careful about font files that have the same name. You might not get the font you want. This is particularly troublesome when the font you get has different font metrics than the one you want. I don’t know how Ghostscript decides which font to use if there is a name collision.
So the bottom line is: put all your fonts in the C:Windows\Fonts directory, and use the FONTPATH command line parameter to get Ghostscript to use it. That’s all there is to it.
I know very little about Ghostscript and there are probably others who could help make this article better. Please comment if you have any suggestions. But my purpose is to make it possible to get Ghostscript to load fonts without understanding too much, or being aware of the vast complexity of Ghostscript when it is not necessary to do so. Please keep this goal in mind when commenting.