1349 lines · 44.3 KB · HTML
RawDownload
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Fonts and font facilities supplied with Ghostscript</title><!-- $Id: Fonts.htm,v 1.51 2005/10/20 19:46:23 ray Exp $ --><!-- Originally: fonts.txt --><link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style"></head> <body><!-- [1.0 begin visible header] ============================================ --> <!-- [1.1 begin headline] ================================================== --> <h1>Fonts and font facilities supplied with Ghostscript</h1> <!-- [1.1 end headline] ==================================================== --> <!-- [1.2 begin table of contents] ========================================= --> <h2>Table of contents</h2> <blockquote><ul><li><a href="#About">About Ghostscript fonts</a><li><a href="#Free_fonts">Ghostscript's free fonts</a><li><a href="#Other_fonts">Other free fonts</a><ul><li><a href="#Computer_Modern">Computer Modern Fontmap</a><li><a href="#Chinese">Free Chinese (Hanzi) fonts</a><li><a href="#Japanese">Free Japanese (Kanji) fonts</a><li><a href="#Unicode_CMaps">Unicode CMaps</a><li><a href="#Cyrillic">Free Cyrillic fonts</a><li><a href="#Partial_Unicode_fonts">(Partial) Unicode fonts</a></ul><li><a href="#Get_fonts">How Ghostscript gets fonts when it runs</a><li><a href="#Platform_fonts">Platform fonts</a><li><a href="#Add_fonts">Adding your own fonts</a><ul><li><a href="#Convert_BDF">Converting BDF fonts</a></ul><li><a href="#For_developers">For developers only</a><ul><li><a href="#Font_contents">Contents of fonts</a><li><a href="#Precompiling">Precompiling fonts</a><li><a href="#Short_identifiers">Precompiling fonts on platforms with identifier length limits</a><li><a href="#Unique_IDs">Font names and unique IDs</a><li><a href="#Codes">Codes used to make font file names</a></ul><li><a href="#Use_gs_fonts_with_X">Using Ghostscript fonts on X Windows displays</a><ul><li><a href="#Using_xset">Using <b><tt>xset</tt></b></a><li><a href="#Font_permanent_installation">Permanent installation</a><ul><li><a href="#Configure_xfs">Configuring the <b><tt>xfs</tt></b> font server</a><li><a href="#Configure_Xfree86">Xfree86 display servers</a></ul></ul></ul></blockquote> <!-- [1.2 end table of contents] =========================================== --> <!-- [1.3 begin hint] ====================================================== --> <p>For other information, see the <a href="Readme.htm">Ghostscriptoverview</a>. <!-- [1.3 end hint] ======================================================== --> <hr> <!-- [1.0 end visible header] ============================================== --> <!-- [2.0 begin contents] ================================================== --> <h2><a name="About"></a>About Ghostscript fonts</h2> <p>Ghostscript is distributed with two kinds of files related to fonts: <ul><li>the fonts themselves in individual files, and<li>a file "<tt><b>Fontmap</b></tt>" that defines forGhostscript which file represents which font.</ul> <p>Additionally, a file <tt><b>cidfmap</b></tt> can be usedto create CID fonts for CJK font files on the system Seethe section on <a href="Use.htm#CIDFontSubstitution">CID Font Substitution</a>for details. <p>Most of the font files supplied with Ghostscript have the extension<tt><b>.pfb</b></tt>, and a few have <tt><b>.pfa</b></tt> or<tt><b>.gsf</b></tt>.  Each file defines one ordinary PostScript Type 1outline font which any PostScript language interpreter can use.  Files with<tt><b>.pfa</b></tt> or <tt><b>.pfb</b></tt> extensions are also compatiblewith Adobe Type Manager (ATM) and with tools that don't include a fullPostScript language interpreter; files with <tt><b>.gsf</b></tt> extensionare incompatible with ATM and other tools. Ghostscript compiled with the"ttfont" option can also use TrueType fonts with the extension<tt><b>.ttf</b></tt>. <p><a name="Fontmap"></a>When Ghostscript needs a font, it must have some way to know where to lookfor it: that's the purpose of the <b><tt>Fontmap</tt></b> file, whichassociates the names of <em>fonts</em> such as <b><tt>/Times-Roman</tt></b>with the names of font <em>files</em>, such as<tt><b>n021003l.pfb</b></tt>.  <b><tt>Fontmap</tt></b> can also createaliases for font names, so that for instance,<b><tt>/NimbusNo9L-Regu</tt></b> means the same font as<b><tt>/Times-Roman</tt></b>. <hr> <h2><a name="Free_fonts"></a>Ghostscript's free fonts</h2> <p>Two sets of free fonts are supplied for Ghostscript: <ul><li>35 commercial-quality Type 1 basic PostScript fonts -- Times,Helvetica, Courier, Symbol, etc. -- contributed by URW++ Design andDevelopment Incorporated, of Hamburg, Germany(<a href="http://www.urwpp.de/">http://www.urwpp.de/</a>).  Fontmap namesthem all. <li>A miscellaneous set including Cyrillic, kana, and fonts derived fromthe free Hershey fonts, with improvements (such as adding accentedcharacters) by Thomas Wolff.  The Hershey-based fonts are quite differentfrom traditional printer or display fonts; you can read about them in moredetail in the <a href="Hershey.htm">documentation on Hershey fonts</a>. </ul> <blockquote><table cellpadding=0 cellspacing=0><tr><th colspan=7 bgcolor="#CCCC00"><hr><font size="+1">Font packages</font><hr><tr>	<td><b>System</b>	<td>&nbsp;&nbsp;	<td><b>File name</b>	<td>&nbsp;&nbsp;	<td><b>Contents</b>	<td>&nbsp;&nbsp;	<td><b>Types</b><tr>	<td colspan=7><hr><tr valign=top>	<td>DOS and<br>MS Windows	<td>&nbsp;	<td><b><tt>gs###fn1.zip</tt></b>	<td>&nbsp;	<td>Basic	<td>&nbsp;	<td><b><tt>.pfb</tt></b><tr valign=top>	<td>&nbsp;	<td>&nbsp;	<td><b><tt>gs###fn2.zip</tt></b>	<td>&nbsp;	<td>Miscellaneous	<td>&nbsp;	<td>Various, for<br>different fonts<tr>	<td colspan=7><hr><tr valign=top>	<td>Unix	<td>&nbsp;	<td><b><tt>ghostscript-fonts-std-#.##.tar.gz</tt></b>	<td>&nbsp;	<td>Basic	<td>&nbsp;	<td><b><tt>.afm</tt></b>,	    <b><tt>.pfb</tt></b>,<br><b><tt>.pfm</tt></b> <tr valign=top> <td>&nbsp;	<td>&nbsp;	<td><b><tt>ghostscript-fonts-other-#.##.tar.gz</tt></b>	<td>&nbsp;	<td>Miscellaneous	<td>&nbsp;	<td><b><tt>.afm</tt></b>,	    <b><tt>.gsf</tt></b>,<br><b><tt>.pfa</tt></b>, <b><tt>.pfm</tt></b> </table></blockquote> <p>"#.##" and "###" are the version number with and without punctuation.Fonts can be found at <blockquote>ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/gs###/ (for a particular version)<br><a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/fonts/" class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/fonts/</a> (forseveral versions)</blockquote> <hr> <h2><a name="Other_fonts"></a>Other free fonts</h2> <h3><a name="Computer_Modern"></a>Computer Modern Fontmap</h3> <p>Don Knuth's Computer Modern fonts are popular, free, and widely available.A Fontmap appropriate for these fonts is available from: <blockquote><ahref="ftp://tug.ctan.org/tex-archive/fonts/cm/ps-type1/contrib/Fontmap.cmr" class="offsite">ftp://tug.ctan.org/tex-archive/fonts/cm/ps-type1/contrib/Fontmap.cmr</a></blockquote> <p>or from other <a href="http://www.ctan.org/" class="offsite">CTAN</a> sites. <h3><a name="Chinese"></a>Free Chinese (Hanzi) fonts</h3> <p>A free Chinese font, originally provided by courtesy of Jackson Technology,Ltd., Taiwan under the GPL and now distributed by the Taiwan NeXT UserGroup, is available from: <blockquote><a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/hanzi/" class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/hanzi/</a></blockquote> <p>Prof. Wu of the Department of Economics of National Taiwan University hascreated several free Type 1 Chinese fonts designed to be used with TeX.  Hise-mail is <ahref="mailto:ntut019@ccms.ntu.edu.tw">ntut019@ccms.ntu.edu.tw</a>.  Thefonts are available from <blockquote><a href="ftp://cle.linux.org.tw/pub/fonts/cwfont/" class="offsite">ftp://cle.linux.org.tw/pub/fonts/cwfont/</a><br></blockquote> <p>Arphic Technology Co., Ltd., has made several free TrueType Chinese fontsavailable under the Arphic Public License, a license very similar to theGPL.  (Ghostscript can use TrueType fonts if Ghostscript is compiled withthe <tt><b>ttfont</b></tt> feature included: see <ahref="Make.htm#Features_and_devices">here</a> for more information.)  Thefonts and license are available from <blockquote><a href="ftp://cle.linux.org.tw/pub/fonts/arphic/" class="offsite">ftp://cle.linux.org.tw/pub/fonts/arphic/</a><br></blockquote> <h3><a name="Japanese"></a>Free Japanese (Kanji) fonts</h3> <p>Mr. Tetsurou Tanaka of the Department of Engineering, University of Tokyo,has created a set of free Kanji fonts available from <blockquote><a href="ftp://ftp.ipl.t.u-tokyo.ac.jp/Font/" class="offsite">ftp://ftp.ipl.t.u-tokyo.ac.jp/Font/</a><br></blockquote> <p>along with documentation in Japanese and English describing theirconditions of use and how to use them.  An older copy of these fonts, undersomewhat different names, is available at the Ghostscript site: <blockquote><a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/kanji/">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/kanji/</a><br></blockquote> <p>Mr. Norio Katayama has done some work to make Ghostscript work well withKanji fonts.  An easy-to-install Kanji font for Ghostscript, withinstallation instructions, is at <blockquote><a href="http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-ttf.html" class="offsite">http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-ttf.html</a></blockquote> <p>The same site has patches to make Ghostscript work with Japanese VF fonts,with documentation in both English and Japanese: <blockquote><a href="http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-vflib.html" class="offsite">http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-vflib.html</a></blockquote> <p>Here are some other resources in Japanese relating to VFlib and usingGhostscript with Japanese fonts: <blockquote><dl compact><dt><a href="http://kakugawa.aial.hiroshima-u.ac.jp/~kakugawa/Hacks/" class="offsite">http://kakugawa.aial.hiroshima-u.ac.jp/~kakugawa/Hacks/</a><dt><a href="http://itohws03.ee.noda.sut.ac.jp/~matsuda/VFlib-FT/" class="offsite">http://itohws03.ee.noda.sut.ac.jp/~matsuda/VFlib-FT/</a><dd>Author &lt;<a href="mailto:matsuda@itohws01.ee.noda.sut.ac.jp">matsuda@itohws01.ee.noda.sut.ac.jp</a>&gt;<dt><a href="http://www.rd.nacsis.ac.jp/~katayama/homepage/ghostscript/Japanese.html"class="offsite">http://www.rd.nacsis.ac.jp/~katayama/homepage/ghostscript/Japanese.html</a><dd>Author &lt;<a href="mailto:katayama@rd.nacsis.ac.jp">katayama@rd.nacsis.ac.jp</a>&gt;</dl></blockquote> <h3><a name="Unicode_CMaps"></a>Unicode CMaps</h3> <p>Some Unicode CMaps that can be used with Ghostscript are freely downloadable from <blockquote><a href="ftp://ftp.oreilly.com/pub/examples/nutshell/ujip/adobe/" class="offsite">ftp://ftp.oreilly.com/pub/examples/nutshell/ujip/adobe/</a></blockquote> <h3><a name="Cyrillic"></a>Free Cyrillic fonts</h3> <p>N. Glonty and A. Samarin created in 1989 a Cyrillic extension of TeX's"Computer Modern" fonts, now freely available through the<a href="http://www.ctan.org/" class="offsite">Comprehensive TeX Archive Network</a> (CTAN),for instance at <blockquote><a href="ftp://ctan.tug.org/tex-archive/fonts/cyrillic/cmcyr/" class="offsite">ftp://ctan.tug.org/tex-archive/fonts/cyrillic/cmcyr/</a></blockquote> <p><a href="http://www.ctan.org/" class="offsite">CTAN's</a> entire collection of Cyrillic fontsis, for instance, at <blockquote><a href="ftp://ctan.tug.org/tex-archive/fonts/cyrillic/" class="offsite">ftp://ctan.tug.org/tex-archive/fonts/cyrillic/</a></blockquote> <p>Basil K. Malyshev created the "Paradissa Fonts Collection" in 1993.  Itcontained 165 fonts, including the Glonty and Samarin font above plus otherComputer Modern, Euler, and LaTeX fonts, all in PostScript Type 1 formatwith <code>.afm</code> and <code>.pfm</code> files, compatible with ATM.The collection could once be found through CTAN, for instance at <blockquote>http://www.ctan.org/tex-archive/fonts/<!-- orginal was ftp://ctan.tug.org/tex-archive/fonts/postscript/cm/ --></blockquote> <p>but the collection no longer seems to be available. However, the<a href="http://www.ctan.org/tex-archive/fonts/" class="offsite">ctan fonts directory</a>remains an excellent source of free fonts, many of which are offered inpostscript as well we as TeX Metafont format. <hr> <h3><a name="Partial_Unicode_fonts"></a>(Partial) Unicode fonts</h3> <p>George W. Wilson is distributing some free partial Unicode fonts he created.These fonts currently lack Arabic and CJK characters, but they include avery large subset of the remaining Unicode set.  They are available in bothType 1 and TrueType formats.  See <blockquote><a href="http://bibliofile.mc.duke.edu/gww/fonts/Unicode.html" class="offsite">http://bibliofile.mc.duke.edu/gww/fonts/Unicode.html</a></blockquote> <h2><a name="Get_fonts"></a>How Ghostscript gets fonts when it runs</h2> <p>Fonts occupy about 50KB each, so Ghostscript doesn't load them allautomatically when it runs.  Instead, as part of normal initializationGhostscript runs a file <tt><b>gs_fonts.ps</b></tt>, which arranges to loadfonts on demand using information from the font map.  To preload all of theknown fonts, invoke the procedure <blockquote><tt><b>loadallfonts</b></tt></blockquote> <p>The file <tt><b>prfont.ps</b></tt> contains code to print a sample page ofa font.  Load this program by including it in the <tt><b>gs</b></tt>command line or by invoking <blockquote><tt><b>(prfont.ps) run</b></tt></blockquote> <p>Then to produce a sampler of a particular font XYZ, invoke <blockquote><tt><b>/XYZ DoFont</b></tt></blockquote> <p>For example, <blockquote><tt><b>/Times-Roman DoFont</b></tt></blockquote> <p>For more information about how Ghostscript loads fonts during execution,see <a href="Use.htm#Font_lookup">here</a>. <hr> <h2><a name="Platform_fonts"></a>Platform fonts</h2> <p>Ghostscript displays text on screen using whatever font technology isprovided by the system on which it runs, by calling the system's API todisplay text.  On platforms with X Windows, this is X Windows; on MSWindows it may be TrueType or ATM; Ghostscript neither knows nor cares. <p>The PostScript language specifies that fonts are data structures withparticular contents (for instance, they include a bounding box for thefont, an Encoding vector to specify the character set, etc.), and it iscommon for PostScript files to use this fact; also, characters can be usedas clipping regions, and can be arbitrarily algorithmically rotated,skewed, expanded or condensed, etc. Most of this information is availablein some form from the underlying graphics system, but one crucial piece isnot: the actual scalable outlines of the characters, which Ghostscriptneeds in order to implement both clipping with character shapes andarbitrarily transformed characters.  Consequently <blockquote>Ghostscript needs the scalable outlines of any font mentioned in adocument, and loads them from the disk (<tt><b>.pfa</b></tt>,<tt><b>.pfb</b></tt>, or <tt><b>.gsf</b></tt>file) in the usual way, even if it uses the platform's font machinery todisplay the characters. In other words, Ghostscript must still be able tofind its font files.</blockquote> <p>To make matters worse, platforms use different names for their standardfonts.  For example, the Times Roman font, for which PostScript files usethe name "<b><tt>Times-Roman</tt></b>", may be known as"<b><tt>Times-Roman</tt></b>", "<b><tt>Times&nbsp;Roman</tt></b>","<b><tt>Tms&nbsp;Rmn</tt></b>","<b><tt>Times&nbsp;New&nbsp;Roman</tt></b>", or"<b><tt>TimesNewRoman</tt></b>".  The name may even be completelydifferent: the usual Helvetica-equivalent TrueType font is called"<b><tt>Arial</tt></b>".  It is possible to deal with this situation byintroducing aliases in Fontmap, but there are two reasons why Ghostscriptdoes not currently do this: <ol><li>Methods of naming in different systems are so unstandardized that thereseems to be no small set of alternative names likely to cover mostsituations.  All five of the names above for Times Roman have been seenunder Windows and OS/2, depending on the version of the system, whether ituses TrueType or ATM, and other unknown factors. <li>Each alias takes up space at run time.  If each of the standard fontshas three additional aliases, this might amount to 50KB of wasted space,which may be a lot on some smaller systems.</ol> <p>If you don't seem to be getting nice characters on the screen under MSWindows, you can try adding aliases to Fontmap, according to thedocumentation you'll find in there. <hr> <h2><a name="Add_fonts"></a>Adding your own fonts</h2> <p>Ghostscript can use any Type 0, 1, 3, 4, or 42 font acceptable toother PostScript language interpreters or to ATM, including MultiMasterfonts.  Beginning with release 4.0, Ghostscript can also use TrueType fontsif it was compiled with the "ttfont" option. <p>To add fonts of your own, you must edit Fontmap to include at the end anentry for your new font; the format for entries is documentedin Fontmap itself.  Since later entries in Fontmap override earlierentries, a font you add at the end supersedes any corresponding fonts suppliedwith Ghostscript and defined earlier in the file. <p>In the PC world, Type 1 fonts are customarily given names ending in<tt><b>.PFA</b></tt> or <tt><b>.PFB</b></tt>.  Ghostscript can use thesedirectly: you just need to make the entry in Fontmap.  If you want to usewith Ghostscript a commercial Type 1 font (such as fonts obtained inconjunction with Adobe Type Manager), please read carefully the license thataccompanies the font to satisfy yourself that you may do so legally; we takeno responsibility for any possible violations of such licenses.  The sameapplies to TrueType fonts. <h3><a name="Convert_BDF"></a>Converting BDF fonts</h3> <p>Ghostscript provides a way to construct a (low-quality) Type 1 font from abitmap font in the BDF format popular in the Unix world.  The shell script<tt><b>bdftops</b></tt> (Unix) or the command file

Lines 1–500 of 1349.