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.
I’m moving to a new computer so I had to reinstall everything. I couldn’t get Ghostscript to work and (surprise, surprise!) I found my own article when I started searching for help. It helped me figure out what was going on, but some things need clarification.
First, you can’t put non-Truetype fonts in the Windows\Fonts folder any more, so those instructions are no longer always valid. And I’m trying to use old Adobe *.pdb fonts. How I had set it up before was to put the fonts I need in the Ghostscript “Resources\Font” folder, and then added a FONTPATH command line parameter referencing it to my command that invokes Ghostscript. Here’s the parameter I used:
Note that the path includes the version number of Ghostscript that is being used. If you use a different version (which is probable) you have to use the appropriate version number. You have to remember to change it if you upgrade Ghostscript.
What I’m Using Ghostscript For
In case it might be helpful, I’m using Ghostscript to convert Postscript files created by an old CAD program that doesn’t support Windows printers to PDF files that I can easily print. I have a BAT file to invoke it, named PS2PDF.BAT, which contains the following command (all on one line of course):
gswin64c -sOutputFile#”%2″ -sDEVICE#pdfwrite “-sFONTPATH#C:\Program Files\gs\gs10.02.0\Resource\Font” -dNOPAUSE -dBATCH “%1”
You invoke it with “ps2pdf file1.ps file2.pdf” where “file1.ps” is the input Postscript file (“%1” in the command line), and “file2.pdf” is the output PDF file (“%2” in the command line). The output file must not already exist.