You are here

Ghostscript Font Testing

Viewing fonts on a screen and printing fonts to a printer are two different paths. Printing on LINUX almost always involves Postscript - of which PDF is a subtype - and the primary engine for creating or modifying Postscript is the Ghostscript package. Given the display path and the print path it is important to verify that a custom or third-party font is correctly installed and is working in Ghostscript.

The tedious way to do this is to create a document that contains that font, print it, and see if it looks OK. And if it doesn't you scratch your head and wonder why, any font related warning or errors are lost in the background. A better way is to run a render test of the font using the Ghostscript CLI.

Aside: Postscript is a domain specific programming language. To create a document on paper the print runs the Postscript program. With the Ghostscript CLI we can run the Postscript program interactively and see the result on a virtual page.

A Postscript program for font rendering is included in the standard Ghostscript package. The name of the program is The first step is to locate this program in the filesystem

awilliam@linux-86wr:~> rpm -ql ghostscript | grep prfont

Text 1: Looking in the ghostscript RPM for the prfont program.

Once you know the path to the Postscript program you can perform the font test.

  1. Start the Ghostscript CLI with the gs command. You should then be at a GS> prompt and have a virtual page window.
  2. Load all the system fonts with the loadallfonts command. You will see Ghostscript loading all the fonts. Watch the output for the font you are interested in [Ctrl-Shift-F in GNOME terminal will search the buffer]. See that it loaded, and if not look for any errors.
  3. Run the prfont program. In Ghostscript's CLI a Postscript program is run using the syntax "(path) run"
  4. Render the font you are interested by calling the DoFont routine in the program. In the CLI functions are called with parameters first and then the method name; so: "/nameoffont DoFont"
  5. If everything works the font will be rendered onto the virtual canvas and you will page through the document by pressing enter.

In practice it will look like:

awilliam@linux-86wr:~> gs
GPL Ghostscript 9.15 (2014-09-22)
Copyright (C) 2014 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading Utopia-BoldItalic font from /usr/share/ghostscript/fonts/putbi.pfa... 4214072 2766915 3914480 2630640 1 done.
Loading URWBookmanL-DemiBoldItal font from /usr/share/ghostscript/9.15/Resource/Font/URWBookmanL-DemiBoldItal... 4214072 2822861 3934672 2637347 1 done.
GS>(/usr/share/ghostscript/9.15/lib/ run
GS<1>/DroidSansGeorgian DoFont
>>showpage, press <return> to continue<<
>>showpage, press <return> to continue<<
>>showpage, press <return> to continue<<

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer