xref: /plan9/sys/src/cmd/gs/doc/Fonts.htm (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<title>Fonts and font facilities supplied with Ghostscript</title>
5<!-- $Id: Fonts.htm,v 1.51 2005/10/20 19:46:23 ray Exp $ -->
6<!-- Originally: fonts.txt -->
7<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style">
8</head>
9
10<body>
11<!-- [1.0 begin visible header] ============================================ -->
12
13<!-- [1.1 begin headline] ================================================== -->
14
15<h1>Fonts and font facilities supplied with Ghostscript</h1>
16
17<!-- [1.1 end headline] ==================================================== -->
18
19<!-- [1.2 begin table of contents] ========================================= -->
20
21<h2>Table of contents</h2>
22
23<blockquote><ul>
24<li><a href="#About">About Ghostscript fonts</a>
25<li><a href="#Free_fonts">Ghostscript's free fonts</a>
26<li><a href="#Other_fonts">Other free fonts</a>
27<ul>
28<li><a href="#Computer_Modern">Computer Modern Fontmap</a>
29<li><a href="#Chinese">Free Chinese (Hanzi) fonts</a>
30<li><a href="#Japanese">Free Japanese (Kanji) fonts</a>
31<li><a href="#Unicode_CMaps">Unicode CMaps</a>
32<li><a href="#Cyrillic">Free Cyrillic fonts</a>
33<li><a href="#Partial_Unicode_fonts">(Partial) Unicode fonts</a>
34</ul>
35<li><a href="#Get_fonts">How Ghostscript gets fonts when it runs</a>
36<li><a href="#Platform_fonts">Platform fonts</a>
37<li><a href="#Add_fonts">Adding your own fonts</a>
38<ul>
39<li><a href="#Convert_BDF">Converting BDF fonts</a>
40</ul>
41<li><a href="#For_developers">For developers only</a>
42<ul>
43<li><a href="#Font_contents">Contents of fonts</a>
44<li><a href="#Precompiling">Precompiling fonts</a>
45<li><a href="#Short_identifiers">Precompiling fonts on platforms with identifier length limits</a>
46<li><a href="#Unique_IDs">Font names and unique IDs</a>
47<li><a href="#Codes">Codes used to make font file names</a>
48</ul>
49<li><a href="#Use_gs_fonts_with_X">Using Ghostscript fonts on X Windows displays</a>
50<ul>
51<li><a href="#Using_xset">Using <b><tt>xset</tt></b></a>
52<li><a href="#Font_permanent_installation">Permanent installation</a>
53<ul>
54<li><a href="#Configure_xfs">Configuring the <b><tt>xfs</tt></b> font server</a>
55<li><a href="#Configure_Xfree86">Xfree86 display servers</a>
56</ul>
57</ul>
58</ul></blockquote>
59
60<!-- [1.2 end table of contents] =========================================== -->
61
62<!-- [1.3 begin hint] ====================================================== -->
63
64<p>For other information, see the <a href="Readme.htm">Ghostscript
65overview</a>.
66
67<!-- [1.3 end hint] ======================================================== -->
68
69<hr>
70
71<!-- [1.0 end visible header] ============================================== -->
72
73<!-- [2.0 begin contents] ================================================== -->
74
75<h2><a name="About"></a>About Ghostscript fonts</h2>
76
77<p>
78Ghostscript is distributed with two kinds of files related to fonts:
79
80<ul>
81<li>the fonts themselves in individual files, and
82<li>a file "<tt><b>Fontmap</b></tt>" that defines for
83Ghostscript which file represents which font.
84</ul>
85
86<p>
87Additionally, a file <tt><b>cidfmap</b></tt> can be used
88to create CID fonts for CJK font files on the system See
89the section on <a href="Use.htm#CIDFontSubstitution">CID Font Substitution</a>
90for details.
91
92<p>
93Most of the font files supplied with Ghostscript have the extension
94<tt><b>.pfb</b></tt>, and a few have <tt><b>.pfa</b></tt> or
95<tt><b>.gsf</b></tt>.  Each file defines one ordinary PostScript Type 1
96outline font which any PostScript language interpreter can use.  Files with
97<tt><b>.pfa</b></tt> or <tt><b>.pfb</b></tt> extensions are also compatible
98with Adobe Type Manager (ATM) and with tools that don't include a full
99PostScript language interpreter; files with <tt><b>.gsf</b></tt> extension
100are incompatible with ATM and other tools. Ghostscript compiled with the
101"ttfont" option can also use TrueType fonts with the extension
102<tt><b>.ttf</b></tt>.
103
104<p><a name="Fontmap"></a>
105When Ghostscript needs a font, it must have some way to know where to look
106for it: that's the purpose of the <b><tt>Fontmap</tt></b> file, which
107associates the names of <em>fonts</em> such as <b><tt>/Times-Roman</tt></b>
108with the names of font <em>files</em>, such as
109<tt><b>n021003l.pfb</b></tt>.  <b><tt>Fontmap</tt></b> can also create
110aliases for font names, so that for instance,
111<b><tt>/NimbusNo9L-Regu</tt></b> means the same font as
112<b><tt>/Times-Roman</tt></b>.
113
114<hr>
115
116<h2><a name="Free_fonts"></a>Ghostscript's free fonts</h2>
117
118<p>
119Two sets of free fonts are supplied for Ghostscript:
120
121<ul>
122<li>35 commercial-quality Type 1 basic PostScript fonts -- Times,
123Helvetica, Courier, Symbol, etc. -- contributed by URW++ Design and
124Development Incorporated, of Hamburg, Germany
125(<a href="http://www.urwpp.de/">http://www.urwpp.de/</a>).  Fontmap names
126them all.
127
128<li>A miscellaneous set including Cyrillic, kana, and fonts derived from
129the free Hershey fonts, with improvements (such as adding accented
130characters) by Thomas Wolff.  The Hershey-based fonts are quite different
131from traditional printer or display fonts; you can read about them in more
132detail in the <a href="Hershey.htm">documentation on Hershey fonts</a>.
133
134</ul>
135
136<blockquote><table cellpadding=0 cellspacing=0>
137<tr><th colspan=7 bgcolor="#CCCC00"><hr><font size="+1">Font packages</font><hr>
138<tr>	<td><b>System</b>
139	<td>&nbsp;&nbsp;
140	<td><b>File name</b>
141	<td>&nbsp;&nbsp;
142	<td><b>Contents</b>
143	<td>&nbsp;&nbsp;
144	<td><b>Types</b>
145<tr>	<td colspan=7><hr>
146<tr valign=top>	<td>DOS and<br>MS Windows
147	<td>&nbsp;
148	<td><b><tt>gs###fn1.zip</tt></b>
149	<td>&nbsp;
150	<td>Basic
151	<td>&nbsp;
152	<td><b><tt>.pfb</tt></b>
153<tr valign=top>	<td>&nbsp;
154	<td>&nbsp;
155	<td><b><tt>gs###fn2.zip</tt></b>
156	<td>&nbsp;
157	<td>Miscellaneous
158	<td>&nbsp;
159	<td>Various, for<br>different fonts
160<tr>	<td colspan=7><hr>
161<tr valign=top>	<td>Unix
162	<td>&nbsp;
163	<td><b><tt>ghostscript-fonts-std-#.##.tar.gz</tt></b>
164	<td>&nbsp;
165	<td>Basic
166	<td>&nbsp;
167	<td><b><tt>.afm</tt></b>,
168	    <b><tt>.pfb</tt></b>,<br><b><tt>.pfm</tt></b> <tr valign=top> <td>&nbsp;
169	<td>&nbsp;
170	<td><b><tt>ghostscript-fonts-other-#.##.tar.gz</tt></b>
171	<td>&nbsp;
172	<td>Miscellaneous
173	<td>&nbsp;
174	<td><b><tt>.afm</tt></b>,
175	    <b><tt>.gsf</tt></b>,<br><b><tt>.pfa</tt></b>, <b><tt>.pfm</tt></b>
176
177</table>
178</blockquote>
179
180<p>
181"#.##" and "###" are the version number with and without punctuation.
182Fonts can be found at
183
184<blockquote>
185ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/gs###/ (for a particular version)<br>
186<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/fonts/"
187class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/fonts/</a> (for
188several versions)
189</blockquote>
190
191<hr>
192
193<h2><a name="Other_fonts"></a>Other free fonts</h2>
194
195<h3><a name="Computer_Modern"></a>Computer Modern Fontmap</h3>
196
197<p>
198Don Knuth's Computer Modern fonts are popular, free, and widely available.
199A Fontmap appropriate for these fonts is available from:
200
201<blockquote>
202<a
203href="ftp://tug.ctan.org/tex-archive/fonts/cm/ps-type1/contrib/Fontmap.cmr"
204class="offsite">
205ftp://tug.ctan.org/tex-archive/fonts/cm/ps-type1/contrib/Fontmap.cmr</a>
206</blockquote>
207
208<p>
209or from other <a href="http://www.ctan.org/" class="offsite">CTAN</a> sites.
210
211<h3><a name="Chinese"></a>Free Chinese (Hanzi) fonts</h3>
212
213<p>
214A free Chinese font, originally provided by courtesy of Jackson Technology,
215Ltd., Taiwan under the GPL and now distributed by the Taiwan NeXT User
216Group, is available from:
217
218<blockquote>
219<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/hanzi/"
220class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/hanzi/</a>
221</blockquote>
222
223<p>
224Prof. Wu of the Department of Economics of National Taiwan University has
225created several free Type 1 Chinese fonts designed to be used with TeX.  His
226e-mail is <a
227href="mailto:ntut019@ccms.ntu.edu.tw">ntut019@ccms.ntu.edu.tw</a>.  The
228fonts are available from
229
230<blockquote>
231<a href="ftp://cle.linux.org.tw/pub/fonts/cwfont/"
232class="offsite">ftp://cle.linux.org.tw/pub/fonts/cwfont/</a><br>
233</blockquote>
234
235<p>
236Arphic Technology Co., Ltd., has made several free TrueType Chinese fonts
237available under the Arphic Public License, a license very similar to the
238GPL.  (Ghostscript can use TrueType fonts if Ghostscript is compiled with
239the <tt><b>ttfont</b></tt> feature included: see <a
240href="Make.htm#Features_and_devices">here</a> for more information.)  The
241fonts and license are available from
242
243<blockquote>
244<a href="ftp://cle.linux.org.tw/pub/fonts/arphic/"
245class="offsite">ftp://cle.linux.org.tw/pub/fonts/arphic/</a><br>
246</blockquote>
247
248<h3><a name="Japanese"></a>Free Japanese (Kanji) fonts</h3>
249
250<p>
251Mr. Tetsurou Tanaka of the Department of Engineering, University of Tokyo,
252has created a set of free Kanji fonts available from
253
254<blockquote>
255<a href="ftp://ftp.ipl.t.u-tokyo.ac.jp/Font/"
256class="offsite">ftp://ftp.ipl.t.u-tokyo.ac.jp/Font/</a><br>
257</blockquote>
258
259<p>
260along with documentation in Japanese and English describing their
261conditions of use and how to use them.  An older copy of these fonts, under
262somewhat different names, is available at the Ghostscript site:
263
264<blockquote>
265<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/kanji/">
266ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/3rdparty/fonts/kanji/</a><br>
267</blockquote>
268
269<p>
270Mr. Norio Katayama has done some work to make Ghostscript work well with
271Kanji fonts.  An easy-to-install Kanji font for Ghostscript, with
272installation instructions, is at
273
274<blockquote>
275<a href="http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-ttf.html"
276class="offsite">http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-ttf.html</a>
277</blockquote>
278
279<p>
280The same site has patches to make Ghostscript work with Japanese VF fonts,
281with documentation in both English and Japanese:
282
283<blockquote>
284<a href="http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-vflib.html"
285class="offsite">http://www.cit.ics.saitama-u.ac.jp/~far/howto/gs-vflib.html</a>
286</blockquote>
287
288<p>
289Here are some other resources in Japanese relating to VFlib and using
290Ghostscript with Japanese fonts:
291
292<blockquote><dl compact>
293<dt><a href="http://kakugawa.aial.hiroshima-u.ac.jp/~kakugawa/Hacks/"
294class="offsite">http://kakugawa.aial.hiroshima-u.ac.jp/~kakugawa/Hacks/</a>
295<dt><a href="http://itohws03.ee.noda.sut.ac.jp/~matsuda/VFlib-FT/"
296class="offsite">http://itohws03.ee.noda.sut.ac.jp/~matsuda/VFlib-FT/</a>
297<dd>Author &lt;<a href="mailto:matsuda@itohws01.ee.noda.sut.ac.jp">matsuda@itohws01.ee.noda.sut.ac.jp</a>&gt;
298<dt><a href="http://www.rd.nacsis.ac.jp/~katayama/homepage/ghostscript/Japanese.html"
299class="offsite">http://www.rd.nacsis.ac.jp/~katayama/homepage/ghostscript/Japanese.html</a>
300<dd>Author &lt;<a href="mailto:katayama@rd.nacsis.ac.jp">katayama@rd.nacsis.ac.jp</a>&gt;
301</dl></blockquote>
302
303<h3><a name="Unicode_CMaps"></a>Unicode CMaps</h3>
304
305<p>
306Some Unicode CMaps that can be used with Ghostscript are freely downloadable from
307
308<blockquote>
309<a href="ftp://ftp.oreilly.com/pub/examples/nutshell/ujip/adobe/"
310class="offsite">ftp://ftp.oreilly.com/pub/examples/nutshell/ujip/adobe/</a>
311</blockquote>
312
313<h3><a name="Cyrillic"></a>Free Cyrillic fonts</h3>
314
315<p>
316N. Glonty and A. Samarin created in 1989 a Cyrillic extension of TeX's
317"Computer Modern" fonts, now freely available through the
318<a href="http://www.ctan.org/" class="offsite">Comprehensive TeX Archive Network</a> (CTAN),
319for instance at
320
321<blockquote>
322<a href="ftp://ctan.tug.org/tex-archive/fonts/cyrillic/cmcyr/"
323class="offsite">ftp://ctan.tug.org/tex-archive/fonts/cyrillic/cmcyr/</a>
324</blockquote>
325
326<p>
327<a href="http://www.ctan.org/" class="offsite">CTAN's</a> entire collection of Cyrillic fonts
328is, for instance, at
329
330<blockquote>
331<a href="ftp://ctan.tug.org/tex-archive/fonts/cyrillic/"
332class="offsite">ftp://ctan.tug.org/tex-archive/fonts/cyrillic/</a>
333</blockquote>
334
335<p>
336Basil K. Malyshev created the "Paradissa Fonts Collection" in 1993.  It
337contained 165 fonts, including the Glonty and Samarin font above plus other
338Computer Modern, Euler, and LaTeX fonts, all in PostScript Type 1 format
339with <code>.afm</code> and <code>.pfm</code> files, compatible with ATM.
340The collection could once be found through CTAN, for instance at
341
342<blockquote>
343http://www.ctan.org/tex-archive/fonts/
344<!-- orginal was ftp://ctan.tug.org/tex-archive/fonts/postscript/cm/ -->
345</blockquote>
346
347<p>
348but the collection no longer seems to be available. However, the
349<a href="http://www.ctan.org/tex-archive/fonts/" class="offsite">ctan fonts directory</a>
350remains an excellent source of free fonts, many of which are offered in
351postscript as well we as TeX Metafont format.
352
353<hr>
354
355<h3><a name="Partial_Unicode_fonts"></a>(Partial) Unicode fonts</h3>
356
357<p>
358George W. Wilson is distributing some free partial Unicode fonts he created.
359These fonts currently lack Arabic and CJK characters, but they include a
360very large subset of the remaining Unicode set.  They are available in both
361Type 1 and TrueType formats.  See
362
363<blockquote>
364<a href="http://bibliofile.mc.duke.edu/gww/fonts/Unicode.html"
365class="offsite">http://bibliofile.mc.duke.edu/gww/fonts/Unicode.html</a>
366</blockquote>
367
368<h2><a name="Get_fonts"></a>How Ghostscript gets fonts when it runs</h2>
369
370<p>
371Fonts occupy about 50KB each, so Ghostscript doesn't load them all
372automatically when it runs.  Instead, as part of normal initialization
373Ghostscript runs a file <tt><b>gs_fonts.ps</b></tt>, which arranges to load
374fonts on demand using information from the font map.  To preload all of the
375known fonts, invoke the procedure
376
377<blockquote><tt><b>
378loadallfonts
379</b></tt></blockquote>
380
381<p>
382The file <tt><b>prfont.ps</b></tt> contains code to print a sample page of
383a font.  Load this program by including it in the <tt><b>gs</b></tt>
384command line or by invoking
385
386<blockquote><tt><b>
387(prfont.ps) run
388</b></tt></blockquote>
389
390<p>
391Then to produce a sampler of a particular font XYZ, invoke
392
393<blockquote><tt><b>
394/XYZ DoFont
395</b></tt></blockquote>
396
397<p>For example,
398
399<blockquote><tt><b>
400/Times-Roman DoFont
401</b></tt></blockquote>
402
403<p>
404For more information about how Ghostscript loads fonts during execution,
405see <a href="Use.htm#Font_lookup">here</a>.
406
407<hr>
408
409<h2><a name="Platform_fonts"></a>Platform fonts</h2>
410
411<p>
412Ghostscript displays text on screen using whatever font technology is
413provided by the system on which it runs, by calling the system's API to
414display text.  On platforms with X Windows, this is X Windows; on MS
415Windows it may be TrueType or ATM; Ghostscript neither knows nor cares.
416
417<p>
418The PostScript language specifies that fonts are data structures with
419particular contents (for instance, they include a bounding box for the
420font, an Encoding vector to specify the character set, etc.), and it is
421common for PostScript files to use this fact; also, characters can be used
422as clipping regions, and can be arbitrarily algorithmically rotated,
423skewed, expanded or condensed, etc. Most of this information is available
424in some form from the underlying graphics system, but one crucial piece is
425not: the actual scalable outlines of the characters, which Ghostscript
426needs in order to implement both clipping with character shapes and
427arbitrarily transformed characters.  Consequently
428
429<blockquote>
430Ghostscript needs the scalable outlines of any font mentioned in a
431document, and loads them from the disk (<tt><b>.pfa</b></tt>,
432<tt><b>.pfb</b></tt>, or <tt><b>.gsf</b></tt>
433file) in the usual way, even if it uses the platform's font machinery to
434display the characters. In other words, Ghostscript must still be able to
435find its font files.
436</blockquote>
437
438<p>
439To make matters worse, platforms use different names for their standard
440fonts.  For example, the Times Roman font, for which PostScript files use
441the name "<b><tt>Times-Roman</tt></b>", may be known as
442"<b><tt>Times-Roman</tt></b>", "<b><tt>Times&nbsp;Roman</tt></b>",
443"<b><tt>Tms&nbsp;Rmn</tt></b>",
444"<b><tt>Times&nbsp;New&nbsp;Roman</tt></b>", or
445"<b><tt>TimesNewRoman</tt></b>".  The name may even be completely
446different: the usual Helvetica-equivalent TrueType font is called
447"<b><tt>Arial</tt></b>".  It is possible to deal with this situation by
448introducing aliases in Fontmap, but there are two reasons why Ghostscript
449does not currently do this:
450
451<ol>
452<li>Methods of naming in different systems are so unstandardized that there
453seems to be no small set of alternative names likely to cover most
454situations.  All five of the names above for Times Roman have been seen
455under Windows and OS/2, depending on the version of the system, whether it
456uses TrueType or ATM, and other unknown factors.
457
458<li>Each alias takes up space at run time.  If each of the standard fonts
459has three additional aliases, this might amount to 50KB of wasted space,
460which may be a lot on some smaller systems.
461</ol>
462
463<p>
464If you don't seem to be getting nice characters on the screen under MS
465Windows, you can try adding aliases to Fontmap, according to the
466documentation you'll find in there.
467
468<hr>
469
470<h2><a name="Add_fonts"></a>Adding your own fonts</h2>
471
472<p>
473Ghostscript can use any Type 0, 1, 3, 4, or 42 font acceptable to
474other PostScript language interpreters or to ATM, including MultiMaster
475fonts.  Beginning with release 4.0, Ghostscript can also use TrueType fonts
476if it was compiled with the "ttfont" option.
477
478<p>
479To add fonts of your own, you must edit Fontmap to include at the end an
480entry for your new font; the format for entries is documented
481in Fontmap itself.  Since later entries in Fontmap override earlier
482entries, a font you add at the end supersedes any corresponding fonts supplied
483with Ghostscript and defined earlier in the file.
484
485<p>
486In the PC world, Type 1 fonts are customarily given names ending in
487<tt><b>.PFA</b></tt> or <tt><b>.PFB</b></tt>.  Ghostscript can use these
488directly: you just need to make the entry in Fontmap.  If you want to use
489with Ghostscript a commercial Type 1 font (such as fonts obtained in
490conjunction with Adobe Type Manager), please read carefully the license that
491accompanies the font to satisfy yourself that you may do so legally; we take
492no responsibility for any possible violations of such licenses.  The same
493applies to TrueType fonts.
494
495<h3><a name="Convert_BDF"></a>Converting BDF fonts</h3>
496
497<p>
498Ghostscript provides a way to construct a (low-quality) Type 1 font from a
499bitmap font in the BDF format popular in the Unix world.  The shell script
500<tt><b>bdftops</b></tt> (Unix) or the command file
501<tt><b>bdftops.bat</b></tt> (DOS) converts a BDF file to a
502scalable outline using <tt><b>bdftops.ps</b></tt> .  Run the
503shell command
504
505<blockquote><tt><b>
506bdftops&nbsp;BDF_filename&nbsp;[AFM_file1_name&nbsp;...]&nbsp;gsf_filename&nbsp;fontname<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UniqueID&nbsp;[XUID]&nbsp;[encodingname]
507</b></tt></blockquote>
508
509<p>
510The arguments have these meanings:
511<blockquote><table cellpadding=0 cellspacing=0>
512<tr valign=top>	<td><tt><b>BDF_filename</b></tt>
513	<td>&nbsp;&nbsp;
514	<td>Input bitmap file in BDF format
515	<td>&nbsp;&nbsp;
516	<td>&nbsp;
517<tr valign=top>	<td><tt><b>AFM_file1_name</b></tt>
518	<td>&nbsp;
519	<td>AFM files giving metrics
520	<td>&nbsp;
521	<td>(Optional)
522<tr valign=top>	<td><tt><b>gsf_filename</b></tt>
523	<td>&nbsp;
524	<td>Output file
525	<td>&nbsp;
526	<td>&nbsp;
527<tr valign=top>	<td><tt><b>fontname</b></tt>
528	<td>&nbsp;
529	<td>Name of the font
530	<td>&nbsp;
531	<td>&nbsp;
532<tr valign=top>	<td><tt><b>UniqueID</b></tt>
533	<td>&nbsp;
534	<td>UniqueID (<a href="#Unique_IDs">as described below</a>)
535	<td>&nbsp;
536	<td>&nbsp;
537<tr valign=top>	<td><tt><b>XUID</b></tt>
538	<td>&nbsp;
539	<td>XUID, in the form <tt><b>n1.n2.n3...</b></tt> (<a href="#Unique_IDs">as described below</a>)
540	<td>&nbsp;
541	<td>(Optional)
542<tr valign=top>	<td><tt><b>encodingname</b></tt>
543	<td>&nbsp;
544	<td>"StandardEncoding" (the default), "ISOLatin1Encoding",<br>"SymbolEncoding", "DingbatsEncoding"
545	<td>&nbsp;
546	<td>(Optional)
547</table></blockquote>
548
549<p>
550For instance
551
552<blockquote><tt><b>
553bdftops&nbsp;pzdr.bdf&nbsp;ZapfDingbats.afm&nbsp;pzdr.gsf&nbsp;ZapfDingbats&nbsp;4100000&nbsp;1000000.1.41
554</b></tt></blockquote>
555
556<p>
557Then make an entry in Fontmap for the <tt><b>.gsf</b></tt>
558file (<tt><b>pzdr.gsf</b></tt> in the example) as
559<a href="#Add_fonts">described above</a>.
560
561<hr>
562
563<h2><a name="For_developers"></a>For developers only</h2>
564
565<p>
566The rest of this document is very unlikely to be of value to ordinary
567users.
568
569<h3><a name="Font_contents"></a>Contents of fonts</h3>
570
571<p>
572As noted above, Ghostscript accepts fonts in the same formats as PostScript
573interpreters.  Type 0, 1, and 3 fonts are documented in the PostScript
574Language Reference Manual (Second Edition); detailed documentation for Type
5751 fonts appears in a separate Adobe book.  Type 2 (compressed format) fonts
576are documented in separate Adobe publications.  Type 4 fonts are not
577documented anywhere; they are essentially Type 1 fonts with a BuildChar or
578BuildGlyph procedure.  Types 9, 10, and 11 (CIDFontType 0, 1, and 2) and
579Type 32 (downloaded bitmap) fonts are documented in Adobe supplements.
580Type 42 (encapsulated TrueType) fonts are documented in an Adobe
581supplement; the TrueType format is documented in publications available
582from Apple and Microsoft.  Ghostscript does not support Type 14 (Chameleon)
583fonts, which use a proprietary Adobe format.
584
585<h3><a name="Precompiling"></a>Precompiling fonts</h3>
586
587<p>
588You can precompile -- convert -- any Type 1 font into C, then compile and
589build it into the Ghostscript executable.  (Type 1 fonts include any font
590whose name ends with <tt><b>.pfa</b></tt> or
591<tt><b>.pfb</b></tt>, and it also includes all the
592Ghostscript <tt><b>.gsf</b></tt> fonts except the Hershey
593fonts.)  This has no effect on rendering speed, but it eliminates the time
594to load the font dynamically, which may make a big improvement in total
595rendering time, especially for multi-page documents.  It also reduces the
596number of auxiliary files required at run time.  Fonts precompiled and
597built into Ghostscript this way need not appear in Fontmap, although if
598they do appear there, no harm is done.
599
600<p><a name="font2c"></a> The utility for precompiling fonts is named
601<tt><b>font2c</b></tt>.  Note that since
602<tt><b>font2c</b></tt> uses the PostScript language program
603<tt><b>font2c.ps</b></tt>, Ghostscript must already be
604available to run it, and Fontmap must contain entries for the fonts you
605want to compile.  For example, to precompile the Times-Italic font,
606
607<blockquote><tt><b>
608font2c Times-Italic ptmri.c
609</b></tt></blockquote>
610
611<p>
612The first argument ("<b><tt>Times-Italic</tt></b>" above) is the font's
613name and the second ("<b><tt>ptmri.c</tt></b>") is the name of the
614resulting C file.  You can use any file name you want, as long as it ends
615in "<tt><b>.c</b></tt>".  It needn't be limited to eight characters unless
616your operating system requires this.  If "<b><tt>XYZ.gsf</tt></b>" or
617"<b><tt>XYZ.pfa</tt></b>" is the font file's name in Fontmap,
618"<b><tt>XYZ.c</tt></b>" is a good choice for the C file.
619
620<p>
621Under VMS, or other systems whose the C compilers limit the length of
622identifiers, you must do something slightly more complicated; for that see
623the section on <a href="#Short_identifiers">short identifiers in C</a>.  On
624VMS also, you must quote the font name ("{font name}") to preserve the
625name's mixed upper and lower case.  For VMS environments in general see
626<a href="Make.htm#VMS">the VMS directions</a> in the documentation on
627building Ghostscript, and ignore the rest of this section.
628
629<p>
630Note that fonts are not supplied with Ghostscript in precompiled form, since
631those files are quite large and can easily be recreated using <a
632href="#font2c"><tt><b>font2c</b></tt></a>.  There is a makefile target to
633run <tt><b>font2c</b></tt> on all the fonts supplied with Ghostscript.
634Invoke it with
635
636<blockquote><b><tt>
637make fonts_standard_c
638</tt></b></blockquote>
639
640<p>Besides running <tt><b>font2c</b></tt>, you must compile the fonts and
641link them into the executable.  To do this, add the compiled fonts feature
642to your platform-specific makefile.  See the
643<a href="Make.htm#Makefile_overview">overview of makefiles</a> in the
644documentation on building Ghostscript for the list of makefiles for each
645platform.  Find the definition of the <tt><b>FEATURE_DEVS</b></tt> macro in
646the makefile, which looks something like this:
647
648<blockquote><tt><b>
649FEATURE_DEVS=$(PSD)psl3.dev&nbsp;$(PSD)pdf.dev&nbsp;$(PSD)dpsnext.dev&nbsp;$(PSD)pipe.dev
650</b></tt></blockquote>
651
652<p>
653and add "ccfonts.dev":
654
655<blockquote><tt><b>
656FEATURE_DEVS=$(PSD)psl3.dev&nbsp;$(PSD)pdf.dev&nbsp;$(PSD)dpsnext.dev&nbsp;$(PSD)pipe.dev&nbsp;$(PSD)ccfonts.dev
657</b></tt></blockquote>
658
659<p>
660Next you must add the specific fonts to <tt><b>int.mak</b></tt>, the
661platform-independent makefile for the interpreter.  This makefile already
662has rules for the standard fonts supplied with Ghostscript, so if you just
663want to compile the standard fonts, you needn't do anything else.  Now we
664describe how to compile other fonts into the executable, such as the Utopia
665or Kana fonts, or your own fonts.
666
667<p>
668Suppose you want to compile the Kana fonts into the executable.  First pick
669one of <b><tt>ccfonts10</tt></b> through <b><tt>ccfonts15</tt></b> as the
670place you will do this, say <b><tt>ccfonts10</tt></b>.  Add your compiled
671font file names, for instance
672
673<blockquote><tt><b>
674ccfonts10_=$(CFOBJ)fhirw.$(OBJ)
675</b></tt></blockquote>
676
677<p>
678(Note the underscore "_".) If this makes the line too long, use another
679line of the same form, for instance,
680
681<blockquote><tt><b>
682ccfonts11_=$(CFOBJ)fkarw.$(OBJ)
683</b></tt></blockquote>
684
685<p>
686Just below the <b><tt>ccfonts10_=</tt></b> line is a line
687
688<blockquote><tt><b>
689ccfonts10=
690</b></tt></blockquote>
691
692<p>
693(Note no underscore.) Add your own fonts to the end of this line, replacing
694dashes ("-") with underscores ("_") in the font names.  For instance:
695
696<blockquote><tt><b>
697ccfonts10=Calligraphic_Hiragana
698</b></tt></blockquote>
699
700<p>
701Again, if a line becomes too long, add another line of the same form, for
702instance,
703
704<blockquote><tt><b>
705ccfonts10=Calligraphic_Hiragana<br>
706ccfonts11=Calligraphic_Katakana
707</b></tt></blockquote>
708
709<p>
710After all the lines of this form, add a pair of lines to compile each font,
711separating these entries from the "ccfonts*" lines and from each other with
712a blank line.  In our example this becomes
713
714<blockquote>
715<pre>$(CFOBJ)fhirw.$(OBJ): $(CFGEN)fhirw.c $(CCFONT)
716	$(CFCC) $(CFO_)fhirw.$(OBJ) $(C_) $(CFGEN)fhirw.c
717
718$(CFOBJ)fkarw.$(OBJ): $(CFGEN)fkarw.c $(CCFONT)
719	$(CFCC) $(CFO_)fkarw.$(OBJ) $(C_) $(CFGEN)fkarw.c
720</pre></blockquote>
721
722<p>
723Finally, run <tt><b>make</b></tt> to build an executable that includes the
724fonts you added.  They are present in <b><tt>FontDirectory</tt></b> when
725Ghostscript starts up.
726
727<h3><a name="Short_identifiers"></a>Precompiling fonts on platforms with identifier length limits</h3>
728
729<p>
730On some platforms the C compiler or linker limits the number of significant
731characters usable in an identifier.  On such platforms, you must do a
732little extra work.
733
734<p>
735Let <em><b>N</b></em> be the maximum number of significant characters in an
736identifier (typically 31).  For each font whose name is longer than
737<em><b>N</b></em>-5 characters, pick an arbitrary identifier that we will
738call the "short name".  This can be any string you want, as long as it
739contains only letters, digits, and underscores; is no longer than
740<em><b>N</b></em>-5 characters; and is different from all other font names
741and short names.  A good choice for this is the name of the C file.  There
742is no harm in doing this for fonts with names shorter than
743<em><b>N</b></em>-5 characters, but it's unnecessary.
744
745<p>
746You must do two different things for fonts that require a short name.
747
748<ol>
749<li>You must supply the short name as a third argument to
750<tt><b>font2c</b></tt>.  For example, to compile
751<b><tt>NewCenturySchlbk-BoldItalic</tt></b> using the short name
752<b><tt>pncbi</tt></b>,
753
754<blockquote><tt><b>
755font2c&nbsp;NewCenturySchlbk-BoldItalic&nbsp;pncbi.c&nbsp;pncbi
756</b></tt></blockquote>
757
758<li>
759Then when you add the font name to the definition of one of the ccfonts*
760macros in the makefile, use the short name, not the actual font name, for
761instance,
762
763<blockquote><table cellpadding=0 cellspacing=0>
764<tr>	<td>Use
765	<td>&nbsp;&nbsp;&nbsp;&nbsp;
766	<td><tt><b>ccfonts12=pncbi</b></tt>
767<tr>	<td>Rather than
768	<td>&nbsp;
769	<td><tt><b>ccfonts12=NewCenturySchlbk_BoldItalic</b></tt>
770</table></blockquote>
771</ol>
772
773<p>
774Everything else is as described above.  This procedure doesn't change the
775name of the font in Fontmap or as seen from within Ghostscript; it just
776works around a limitation of some older compilers.
777
778<hr>
779
780<h3><a name="Unique_IDs"></a>Font names and unique IDs</h3>
781
782<p>
783If you create your own fonts and will use them only within your own
784organization, you should use <tt><b>UniqueID</b></tt> values between
7854000000 and 4999999, coded like this (see the <a href="#Codes">tables of
786codes</a> for font file names below):
787
788<blockquote><table cellpadding=0 cellspacing=0>
789<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Coding of UniqueID "<tt><b>4TTWVE0</b></tt>"</font><hr>
790<tr>	<td><tt><b>TT</b></tt>
791	<td>&nbsp;&nbsp;
792	<td><a href="#Typeface">Typeface</a>
793	<td>&nbsp;&nbsp;
794	<td>two-digit identifier
795<tr>	<td><tt><b>W</b></tt>
796	<td>&nbsp;
797	<td><a href="#Weight">Weight</a>
798	<td>&nbsp;
799	<td>normal, bold, etc.
800<tr>	<td><tt><b>V</b></tt>
801	<td>&nbsp;
802	<td><a href="#Variant">Variant</a>
803	<td>&nbsp;
804	<td>normal, italic, etc.
805<tr>	<td><tt><b>E</b></tt>
806	<td>&nbsp;
807	<td><a href="#Expansion">Expansion</a>
808	<td>&nbsp;
809	<td>normal, condensed, etc.
810</table></blockquote>
811
812<p>
813This scheme will not work forever: as soon there are more than 99
814typefaces, or more than 9 weights or variants, we will have to do something
815else. But it suffices for the near future.
816
817<p>
818If you plan to distribute fonts, ask Adobe to assign you some UniqueIDs and
819also an <tt><b>XUID</b></tt> for your organization. Contact
820
821<blockquote><address>
822Unique ID Coordinator<br>
823Adobe Developers Association<br>
824Adobe Systems, Inc.<br>
825345 Park Avenue<br>
826San Jose, CA  95110-2704<br>
827+1-408-536-9000 telephone (ADA)<br>
828+1-408-536-6883 fax<br>
829<a href="mailto:fontdev-person@adobe.com">fontdev-person@adobe.com</a><br>
830</address></blockquote>
831
832<p>
833The XUID is a Level 2 PostScript feature that serves the same function as
834the UniqueID, but is not limited to a single 24-bit integer.  The
835<tt><b>bdftops</b></tt> program creates XUIDs of the form
836"<tt><b>[-X-&nbsp;0&nbsp;-U-]</b></tt>" where "<tt><b>-X-</b></tt>" is the
837organization XUID and "<tt><b>-U-</b></tt>" is the UniqueID.  (Aladdin
838Enterprises' organization XUID, which appears in a few places in various
839font-related files distributed with Ghostscript, is 107; do not use this for
840your own fonts that you distribute.)
841
842<p>
843Because Ghostscript runs on many different systems, including DOS, the
844names of font files can be no longer than 8 characters.  We therefore
845construct a font's filename <tt><b>FTTWVVVE.gsf</b></tt>
846similarly to the construction for temporary UniqueIDs.
847
848<blockquote><table cellpadding=0 cellspacing=0>
849<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Coding of font file name "<tt><b>FTTWVVVE.gsf</b></tt>"</font><hr>
850<tr>	<td><tt><b>F</b></tt>
851	<td>&nbsp;&nbsp;
852	<td><a href="#Foundries">Foundry</a>
853	<td>&nbsp;&nbsp;
854	<td>&nbsp;
855<tr>	<td><tt><b>TT</b></tt>
856	<td>&nbsp;
857	<td><a href="#Typeface">Typeface</a>
858	<td>&nbsp;
859	<td>two-digit identifier
860<tr>	<td><tt><b>W</b></tt>
861	<td>&nbsp;
862	<td><a href="#Weight">Weight</a>
863	<td>&nbsp;
864	<td>normal, bold, etc.
865<tr>	<td><tt><b>V</b></tt>
866	<td>&nbsp;
867	<td><a href="#Variant">Variant</a>
868	<td>&nbsp;
869	<td>normal, italic, etc.
870<tr>	<td><tt><b>E</b></tt>
871	<td>&nbsp;
872	<td><a href="#Expansion">Expansion</a>
873	<td>&nbsp;
874	<td>normal, condensed, etc.
875</table></blockquote>
876
877<p>
878Since a font can have multiple variants (for example, Lucida Regular Sans
879Typewriter Italic) we allocate three letters to that; if a font has four
880variants, you're on your own.  If a font does have multiple variants, it's
881best to add the expansion letter "<b><tt>r</tt></b>" to make clear which
882letters are variants and which the expansion.  This scheme is very close to
883the one proposed in "Filenames for fonts", published in the first 1990
884issue of <em>TUGboat</em> (the journal of the TeX Users Group).
885
886<h3><a name="Codes"></a>Codes used to make font file names</h3>
887
888<p>
889In the following tables we make no attempt to be exhaustive: instead we
890have simply allocated entries for those things that we needed for the fonts
891that we are actually distributing.
892
893<p>
894<a name="Foundries"></a>
895<blockquote><table cellpadding=0 cellspacing=0>
896<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Font foundry codes</font><hr>
897<tr>	<th>ID
898	<th>&nbsp;&nbsp;
899	<th align=left>Foundry
900<tr>	<td colspan=3><hr>
901<tr>	<td><tt><b>b</b></tt>
902	<td>&nbsp;&nbsp;
903	<td>Bitstream
904<tr>	<td><tt><b>f</b></tt>
905	<td>&nbsp;
906	<td>Freely distributable and public-domain
907<tr>	<td><tt><b>hr</b></tt>
908	<td>&nbsp;
909	<td>Hershey
910<tr>	<td><tt><b>n</b></tt>
911	<td>&nbsp;
912	<td>IBM
913<tr>	<td><tt><b>p</b></tt>
914	<td>&nbsp;
915	<td>Adobe ("p" for PostScript)
916<tr>	<td><tt><b>u</b></tt>
917	<td>&nbsp;
918	<td>URW[++]
919</table></blockquote>
920
921<p>
922<a name="Typeface"></a>
923<blockquote><table cellpadding=0 cellspacing=0>
924<tr><th colspan=7 bgcolor="#CCCC00"><hr><font size="+1">Typeface codes</font><hr>
925<tr valign=bottom>	<th>ID
926	<td>&nbsp;&nbsp;
927	<th align=left>Name
928	<td>&nbsp;&nbsp;
929	<th align=left>Filename<br>prefix
930	<td>&nbsp;&nbsp;
931	<th align=left>Source
932<tr>	<td colspan=7><hr>
933<tr>	<td><tt><b>08</b></tt>
934	<td>&nbsp;
935	<td>Avant Garde
936	<td>&nbsp;
937	<td><tt><b>pag</b></tt>
938	<td>&nbsp;
939	<td>Adobe
940<tr>	<td><tt><b>11</b></tt>
941	<td>&nbsp;
942	<td>Bookman
943	<td>&nbsp;
944	<td><tt><b>pbk</b></tt>
945	<td>&nbsp;
946	<td>Adobe
947<tr>	<td><tt><b>01</b></tt>
948	<td>&nbsp;
949	<td>CharterBT
950	<td>&nbsp;
951	<td><tt><b>bch</b></tt>
952	<td>&nbsp;
953	<td>Bitstream
954<tr>	<td><tt><b>02</b></tt>
955	<td>&nbsp;
956	<td>Courier
957	<td>&nbsp;
958	<td><tt><b>ncr</b></tt>
959	<td>&nbsp;
960	<td>IBM
961<tr>	<td><tt><b>03</b></tt>
962	<td>&nbsp;
963	<td>Helvetica
964	<td>&nbsp;
965	<td><tt><b>phv</b></tt>
966	<td>&nbsp;
967	<td>Adobe
968<tr>	<td><tt><b>04</b></tt>
969	<td>&nbsp;
970	<td>New Century Schoolbook
971	<td>&nbsp;
972	<td><tt><b>pnc</b></tt>
973	<td>&nbsp;
974	<td>Adobe
975<tr>	<td><tt><b>09</b></tt>
976	<td>&nbsp;
977	<td>Palatino
978	<td>&nbsp;
979	<td><tt><b>ppl</b></tt>
980	<td>&nbsp;
981	<td>Adobe
982<tr>	<td><tt><b>05</b></tt>
983	<td>&nbsp;
984	<td>Symbol
985	<td>&nbsp;
986	<td><tt><b>psy</b></tt>
987	<td>&nbsp;
988	<td>Adobe
989<tr>	<td><tt><b>06</b></tt>
990	<td>&nbsp;
991	<td>Times
992	<td>&nbsp;
993	<td><tt><b>ptm</b></tt>
994	<td>&nbsp;
995	<td>Adobe
996<tr>	<td>--
997	<td>&nbsp;
998	<td>Utopia
999	<td>&nbsp;
1000	<td><tt><b>put</b></tt>
1001	<td>&nbsp;
1002	<td>Adobe
1003<tr>	<td><tt><b>07</b></tt>
1004	<td>&nbsp;
1005	<td>Zapf Chancery
1006	<td>&nbsp;
1007	<td><tt><b>zc</b></tt>
1008	<td>&nbsp;
1009	<td>public domain
1010<tr>	<td><tt><b>10</b></tt>
1011	<td>&nbsp;
1012	<td>Zapf Dingbats
1013	<td>&nbsp;
1014	<td><tt><b>pzd</b></tt>
1015	<td>&nbsp;
1016	<td>Adobe
1017<tr>	<td><tt><b>12</b></tt>
1018	<td>&nbsp;
1019	<td>public domain Cyrillic
1020	<td>&nbsp;
1021	<td><tt><b>fcy</b></tt>
1022	<td>&nbsp;
1023	<td>public domain
1024<tr>	<td><tt><b>13</b></tt>
1025	<td>&nbsp;
1026	<td>Kevin Hartig Hiragana
1027	<td>&nbsp;
1028	<td><tt><b>fhi</b></tt>
1029	<td>&nbsp;
1030	<td>shareware
1031<tr>	<td><tt><b>14</b></tt>
1032	<td>&nbsp;
1033	<td>Kevin Hartig Katakana
1034	<td>&nbsp;
1035	<td><tt><b>fka</b></tt>
1036	<td>&nbsp;
1037	<td>shareware
1038<tr>	<td><tt><b>90</b></tt>
1039	<td>&nbsp;
1040	<td>Hershey Gothic English
1041	<td>&nbsp;
1042	<td><tt><b>hrge</b></tt>
1043	<td>&nbsp;
1044	<td>freeware
1045<tr>	<td><tt><b>91</b></tt>
1046	<td>&nbsp;
1047	<td>Hershey Gothic Italian
1048	<td>&nbsp;
1049	<td><tt><b>hrit</b></tt>
1050	<td>&nbsp;
1051	<td>freeware
1052<tr>	<td><tt><b>92</b></tt>
1053	<td>&nbsp;
1054	<td>Hershey Gothic German
1055	<td>&nbsp;
1056	<td><tt><b>hrgr</b></tt>
1057	<td>&nbsp;
1058	<td>freeware
1059<tr>	<td><tt><b>93</b></tt>
1060	<td>&nbsp;
1061	<td>Hershey Greek
1062	<td>&nbsp;
1063	<td><tt><b>hrgk</b></tt>
1064	<td>&nbsp;
1065	<td>freeware
1066<tr>	<td><tt><b>94</b></tt>
1067	<td>&nbsp;
1068	<td>Hershey Plain
1069	<td>&nbsp;
1070	<td><tt><b>hrpl</b></tt>
1071	<td>&nbsp;
1072	<td>freeware
1073<tr>	<td><tt><b>95</b></tt>
1074	<td>&nbsp;
1075	<td>Hershey Script
1076	<td>&nbsp;
1077	<td><tt><b>hrsc</b></tt>
1078	<td>&nbsp;
1079	<td>freeware
1080<tr>	<td><tt><b>96</b></tt>
1081	<td>&nbsp;
1082	<td>Hershey Symbol
1083	<td>&nbsp;
1084	<td><tt><b>hrsy</b></tt>
1085	<td>&nbsp;
1086	<td>freeware
1087</table></blockquote>
1088
1089<p>
1090<a name="Weight"></a>
1091<blockquote><table cellpadding=0 cellspacing=0>
1092<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Font weight codes</font><hr>
1093<tr>	<th>ID
1094	<td>&nbsp;&nbsp;
1095	<th align=left>Type
1096	<td>&nbsp;&nbsp;
1097	<th align=left>Filename
1098<tr>	<td colspan=5><hr>
1099<tr>	<td><tt><b>0</b></tt>
1100	<td>&nbsp;&nbsp;
1101	<td>normal
1102	<td>&nbsp;&nbsp;
1103	<td><tt><b>r</b></tt>
1104<tr>	<td><tt><b>1</b></tt>
1105	<td>&nbsp;
1106	<td>bold
1107	<td>&nbsp;
1108	<td><tt><b>b</b></tt>
1109<tr>	<td><tt><b>2</b></tt>
1110	<td>&nbsp;
1111	<td>book
1112	<td>&nbsp;
1113	<td><tt><b>k</b></tt>
1114<tr>	<td><tt><b>3</b></tt>
1115	<td>&nbsp;
1116	<td>demi
1117	<td>&nbsp;
1118	<td><tt><b>d</b></tt>
1119<tr>	<td><tt><b>4</b></tt>
1120	<td>&nbsp;
1121	<td>light
1122	<td>&nbsp;
1123	<td><tt><b>l</b></tt>
1124<tr>	<td>&nbsp;
1125<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1"><a name="Variant"></a>Font variants</font><hr>
1126<tr>	<th>ID
1127	<td>&nbsp;&nbsp;
1128	<th align=left>Type
1129	<td>&nbsp;&nbsp;
1130	<th align=left>Filename
1131<tr>	<td colspan=5><hr>
1132<tr>	<td><tt><b>0</b></tt>
1133	<td>&nbsp;&nbsp;
1134	<td>normal
1135	<td>&nbsp;&nbsp;
1136	<td><tt><b>r</b></tt> (omitted when weight is normal)
1137<tr>	<td><tt><b>1</b></tt>
1138	<td>&nbsp;
1139	<td>italic
1140	<td>&nbsp;
1141	<td><tt><b>i</b></tt>
1142<tr>	<td><tt><b>2</b></tt>
1143	<td>&nbsp;
1144	<td>oblique
1145	<td>&nbsp;
1146	<td><tt><b>o</b></tt>
1147<tr valign=top>	<td><tt><b>3</b></tt>
1148	<td>&nbsp;
1149	<td>script, handwritten, swash
1150	<td>&nbsp;
1151	<td><tt><b>w</b></tt>
1152<tr>	<td>&nbsp;
1153<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1"><a name="Expansion"></a>Expansion</font><hr>
1154<tr>	<th>ID
1155	<td>&nbsp;&nbsp;
1156	<th align=left>Type
1157	<td>&nbsp;&nbsp;
1158	<th align=left>Filename
1159<tr>	<td colspan=5><hr>
1160<tr>	<td><tt><b>0</b></tt>
1161	<td>&nbsp;&nbsp;
1162	<td>normal
1163	<td>&nbsp;&nbsp;
1164	<td><tt><b>r</b></tt> (omitted when weight and variant are normal)
1165<tr>	<td><tt><b>1</b></tt>
1166	<td>&nbsp;
1167	<td>narrow
1168	<td>&nbsp;
1169	<td><tt><b>n</b></tt>
1170</table></blockquote>
1171
1172<hr>
1173
1174<h2><a name="Use_gs_fonts_with_X"></a>Using Ghostscript fonts on X Windows displays</h2>
1175
1176<p>
1177The standard X11 distribution can display various kinds of fonts, including
1178the Adobe Type 1 format, so font files distributed with Ghostscript can be
1179used on X Windows displays.  Beginning with Ghostscript version 6.0, the
1180font archive contains the directory files needed to map Ghostscript's font
1181files to XLFDs.  Those files are named "<b><tt>fonts.dir</tt></b>" and
1182"<b><tt>fonts.scale</tt></b>".  There are two main methods to configure
1183your display to use these files.
1184
1185<ul>
1186<li><a href="#Using_xset">With <b><tt>xset</tt></b></a> any user can add a
1187new directory to the font search path for the duration of a session.
1188<li>An administrator with root access can <a
1189href="#Font_permanent_installation">add the Ghostscript font directory
1190permanently</a> to the <a href="#X_font_catalog">X font server's
1191catalog</a> or to an <a href="#Xfree86_fontpath">X display server's list of
1192directories</a>.
1193</ul>
1194
1195<h3><a name="Using_xset"></a>Using <b><tt>xset</tt></b></h3>
1196
1197<p>
1198Users without root access can add the Ghostscript font directories to the
1199font search path using <b><tt>xset</tt></b>. Such a setting is transient
1200and must be repeated each time the display server is reset or restarted,
1201typically at login, so the call to <b><tt>xset</tt></b> should be added to
1202the user's "<b><tt>.xsession</tt></b>" or "<b><tt>.xinitrc</tt></b>"
1203startup script to make the fonts available at each login.
1204
1205<p>
1206To add a new font directory, invoke <b><tt>xset</tt></b> like this:
1207
1208<blockquote>
1209<b><tt>xset fp+</tt> <em>{directory}</em></b>
1210</blockquote>
1211
1212<p>
1213where <b><em>{directory}</em></b> is the full pathname to the directory
1214containing the fonts on the host running the X display server.  For common
1215Ghostscript installations the path is
1216
1217<blockquote>
1218<b><tt>/usr/local/Ghostscript/share/fonts</tt></b>
1219</blockquote>
1220
1221<h3><a name="Font_permanent_installation"></a>Permanent installation</h3>
1222
1223<p> A system administrator, or anyone with the necessary root privilege,
1224can make Ghostscript's fonts permanently available to the managed X display
1225servers.  This setup depends on the servers and the methods used
1226to make the fonts available.
1227
1228<h4><a name="Configure_xfs"></a>Configuring the <b><tt>xfs</tt></b> font server</h4>
1229
1230<p>
1231An X display server can obtain its font resources from a dedicated X font
1232server.  <b><tt>xfs</tt></b> is a prototype font server included in the X
1233Consortium X11 distribution.  It is configured with a file located in a
1234directory whose exact location is installation-dependent and could be any
1235of
1236
1237<blockquote><b><tt>
1238/usr/lib/X11/fs/config
1239<br>/usr/X11/lib/X11/fs/config
1240<br>/usr/X11R6/lib/X11/fs/config
1241</tt></b></blockquote>
1242
1243<p>
1244or some similar name. You can also use <b><tt>xfs</tt></b>'s
1245"<b><tt>-config</tt></b>" command-line option to specify the location of
1246the configuration file.
1247
1248<p><a name="X_font_catalog"></a>
1249The configuration file designates a list ("catalog") of directories, each
1250of which contains fonts and a font mapping database (the file
1251"<b><tt>fonts.dir</tt></b>").  This list is specified with the
1252"<b><tt>catalogue=</tt></b>" keyword followed by a list of absolute
1253directory paths separated by commas.  To add the Ghostscript directory,
1254include its full name in the catalog list, for example:
1255
1256<blockquote><b><tt>
1257catalogue&nbsp;=&nbsp;/usr/local/share/Ghostscript/fonts/,
1258<br>/usr/X11R6/lib/X11/fonts/misc/,
1259<br>/usr/X11R6/lib/X11/fonts/Speedo/,
1260<br>/usr/X11R6/lib/X11/fonts/Type1/,
1261<br>/usr/X11R6/lib/X11/fonts/75dpi/,
1262<br>/usr/X11R6/lib/X11/fonts/100dpi/
1263</tt></b></blockquote>
1264
1265<p>
1266The fonts are searched in the order the directories are specified, so an
1267XLFD mapped by the Ghostscript directory could shadow a previous similar
1268description specified in the following directories.  Once the file is
1269modified, instruct the font server to reload the configuration file by
1270sending it the USR1 signal:
1271
1272<blockquote>
1273<b><tt>kill -HUP</tt> <em>{pid}</em></b>
1274</blockquote>
1275
1276<p>
1277where <b><em>{pid}</em></b> is the font server process's numeric process
1278ID, as obtained with the "<b><tt>ps</tt></b>" command. Be sure to check
1279that the server is still alive after signaling it: it is very picky and
1280could decide to shut itself down if something is wrong in the new
1281configuration. If this happens, restart the server by hand and try to
1282figure out from its output what's happening. If the font server dies,
1283display servers using it will experience problems, so be sure to send the
1284signal from the console or from a display not using that font server!
1285
1286<h4><a name="Configure_Xfree86"></a>Xfree86 display servers</h4>
1287
1288<p><a name="Xfree86_fontpath"></a>
1289With the family of Xfree86 display servers, adding a new font directory
1290permanently requires editing the "<b><tt>/etc/XF86Config</tt></b>" setup
1291file to add a new "<b><tt>FontPath</tt></b>" to the "<b><tt>Files</tt></b>"
1292section:
1293
1294<blockquote>
1295<b><tt>Section "Files"
1296<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RgbPath&nbsp;&nbsp;&nbsp;&nbsp;"/usr/X11R6/lib/X11/rgb"
1297<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FontPath&nbsp;&nbsp;&nbsp;"/usr/local/share/Ghostscript/fonts"
1298<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FontPath&nbsp;&nbsp;&nbsp;"/usr/X11R6/lib/X11/fonts/misc:unscaled"
1299<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FontPath&nbsp;&nbsp;&nbsp;"/usr/X11R6/lib/X11/fonts/75dpi:unscaled"
1300<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FontPath&nbsp;&nbsp;&nbsp;"/usr/X11R6/lib/X11/fonts/100dpi:unscaled"
1301<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FontPath&nbsp;&nbsp;&nbsp;"/usr/X11R6/lib/X11/fonts/Type1"
1302<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FontPath&nbsp;&nbsp;&nbsp;"/usr/X11R6/lib/X11/fonts/Speedo"
1303<br>EndSection</tt></b>
1304</blockquote>
1305
1306<p>
1307The fonts are searched in the order the directories are specified, so an
1308XLFD mapped by the Ghostscript directory could shadow a previous similar
1309description specified in the following directories.  Once this global
1310configuration is edited, the new fonts become available to all Xfree86
1311servers in use on that host. If a server is running, it must be restarted
1312to take effect: just quit the current session in the usual way.  If the
1313server is under the control of <b><tt>xdm</tt></b>, you may have to kill
1314it, because it is usually reset only between successive sessions.
1315
1316<p>
1317This section by Bertrand Petit
1318&lt;<a href="mailto:eegs@phoe.frmug.org">eegs@phoe.frmug.org</a>&gt;
1319
1320<!-- [2.0 end contents] ==================================================== -->
1321
1322<!-- [3.0 begin visible trailer] =========================================== -->
1323<hr>
1324
1325<p>
1326<small>Copyright &copy; 1996, 1997, 1998, 1999, 2000 Aladdin
1327Enterprises. All rights reserved.</small>
1328
1329<p>
1330This software is provided AS-IS with no warranty, either express or
1331implied.
1332
1333This software is distributed under license and may not be copied,
1334modified or distributed except as expressly authorized under the terms
1335of the license contained in the file LICENSE in this distribution.
1336
1337For more information about licensing, please refer to
1338http://www.ghostscript.com/licensing/. For information on
1339commercial licensing, go to http://www.artifex.com/licensing/ or
1340contact Artifex Software, Inc., 101 Lucas Valley Road #110,
1341San Rafael, CA  94903, U.S.A., +1(415)492-9861.
1342
1343<p>
1344<small>Ghostscript version 8.53, 20 October 2005
1345
1346<!-- [3.0 end visible trailer] ============================================= -->
1347
1348</body>
1349</html>
1350