1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Making Fonts Available To Ghostscript
Font HowTo
 Related Resources
• Home
• 1. Introduction
• 2. Fonts 101 -- A Quick Introduction to Fonts
• 3. Fonts 102 -- Typography
• 4. Making Fonts Available To X
• 5. Making Fonts Available To Ghostscript
• 6. True Type to Type 1 Conversion
• 7. WYSIWYG Publishing and Fonts
• 8. Netscape
• 9. TeX / LaTeX
• 10. Getting Fonts For Linux
11. Useful Font Software for Linux
• 12. Ethics and Licensing Issues Related to Type
• 13. References
• 14. Glossary

To make fonts available to ghostscript, it suffices to tell ghostscript where the files corresponding to a given font are located. The file that needs to be edited is /usr/share/ghostscript/version/Fontmap. The format is very simple, almost immediately self evident on perusing it.

5.1. Type 1

Adding Type 1 fonts is straightforward. Run type1inst on the directory containing the font. type1inst will output a file called Fontmap. Append this file to the ghostscript Fontmap file.

5.2. True Type

Adding truetype fonts is a little trickier, because we have to get the name of the TrueType font. One way (brute force, alas) to do this is using the ttf2pt1 TrueType to Type 1 converter, and grabbing the font name from the afm ( there's got to be a more efficient way ! but this works, ugly as it is ). You do it like this:

ttf2pt1 -A fontname - 2 > /dev/null |grep FontName

Then you add an entry to the ghostscript Fontmap file in the correct format, eg some-font (/usr/share/fonts/subdirectory/somefont.pbf); Well, that works fine, but try doing it with 500 or so fonts. This is the kind of thing that calls for a short perlscript:

# ttfontmap -- generate fontmap file for TrueType fonts
my $directory=shift || print STDERR "Usage: ttfontmap {directory}\n";


for my $fontname ( glob ( "$directory/*.ttf" ) )
open ( R, "sh -c \"ttf2pt1 -A $fontname - 2>/dev/null\" |" );
while ( <R> )
if ( $_ =~ /^FontName/ )
print "/" . $_ . " ($fontname);\n" ;
close R;

You can download this script

To set this script up, all you need to do is cut and paste it into a file called ttfontmap, and place the file somewhere in your PATH ( such as /usr/bin ). You run this script like this:

ttfontmap directory > output_file

where directory is the directory containing the fonts. You are left with the file output_file which you can append to your ghostscript fontmap. Note: some will observe that you could just use ttfontmap directory >> /usr/share/ghostscript/version/Fontmap However, I advise against this ( what would happen if you typed ``>'' instead of ``>>'' ? )

5.3. Using Ghostscript To Preview Fonts

Once you've made fonts available to ghostscript, you can preview them. Do this by running the ghostscript interpreter on the file prfont.ps in your ghostscript installation, and after you start it, type: /Fontname DoFont at the ghostscript font ( where FontName is the ghostscript name of the font you wish to preview ). There are several other ways you can invoke gs. For example, if you want to create a PostScript file that you can look at in a nicer PostScript viewer such as gv, you can use gs -sDEVICE=pswrite -sOutputFile=somefile.ps prfont.ps Having done this, you can also print your output file.

Font HowTo
Table of Contents

1. Introduction
    1.1. The Location of This Document
    1.2. Submitting corrections/errata
    1.3. Last Updated
    1.4. Copyright
    1.5. Rationale
    1.6. Credits and Acknowledgements
2. Fonts 101 -- A Quick Introduction to Fonts
    2.1. Types of Fonts
    2.2. Families of Typefaces
3. Fonts 102 -- Typography
    3.1. Classifications of Typefaces
    3.2. Ligatures, Small caps fonts and expert fonts
    3.3. Font Metrics and Shapes
4. Making Fonts Available To X
    4.1. The font path
    4.2. Installing Type 1 Fonts
    4.3. True Type Fonts
    4.4. xfs
5. Making Fonts Available To Ghostscript
    5.1. Type 1
    5.2. True Type
    5.3. Using Ghostscript To Preview Fonts
6. True Type to Type 1 Conversion
    6.1. Why ?
    6.2. How ?
7. WYSIWYG Publishing and Fonts
    7.1. Introduction and Overview
    7.2. Applixware
    7.3. Star Office
    7.4. Word Perfect
8. Netscape
9. TeX / LaTeX
    9.1. A Quick Primer on LaTeX/TeX fonts
    9.2. Adding Type 1 fonts
10. Getting Fonts For Linux
    10.1. True Type
    10.2. Type 1 Fonts and Metafont
11. Useful Font Software for Linux
12. Ethics and Licensing Issues Related to Type
13. References
    13.1. Font Information
    13.2. Postscript and Printing Information
14. Glossary

Can't find what you are looking for?
Search the


Stay up-to-date!
Subscribe to the Linux free newsletter.

Explore Linux
By Category
    linuxLinuxcomputeTechb0502bb1540001006c84963cb0502bb1540002006c818e0ahttp://linux.about.comod526F6F74132058liveGary Newelllinuxguide3TO004KpzNIP11970-01-0110/od/index.htm0526F6F741approved/od
  1. About.com
  2. Tech
  3. Linux

©2016 About.com. All rights reserved.