summaryrefslogtreecommitdiff
path: root/doc/Fonts.htm
blob: b4134a054c6dd1165619232f917a5fecd23f20a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="../../images/favicon.png">
<title>Fonts and Font Facilities Supplied with Ghostscript</title>
    <!-- Originally: fonts.txt -->
<link href="style.css" rel="stylesheet" type="text/css">
<link href="gs-style.css" rel="stylesheet" type="text/css">
</head>

<body>

    <div class="header">
    <div class="row">
        <div class="col-lt-6 logo"><a href="https://www.ghostscript.com/"><img src="images/ghostscript_logo.png" width="108" height="119" alt=""></a></div>
        <div class="col-6"><div class="row"><div class="artifexlogo"><a href="https://artifex.com" target="_blank"><img src="images/Artifex_logo.png" width="194" height="40" alt=""></a></div>
        <div class="col-12"><div class="button button1"><a href="https://artifex.com/contact-us/" title="Contact Us" target="_blank">Contact Us</a></div>
        <div class="button button2 hidden-xs"><a href="https://www.ghostscript.com/download.html" title="Download">Download</a></div></div></div>
    </div>
    </div>
    </div>

    <div class="banner">
    <div class="row">
        <div class="col-12">Fonts and Font Facilities Supplied with Ghostscript</div>
    </div>
    </div>

    <div class="main">
    <div class="row">
    <div id="sidebar">
    <div class="sidebar-item"></div>
    <div class="col-2 leftnav">
    <ul>
            <li><a href="https://www.ghostscript.com/">Home</a></li>
            <li><a href="https://www.ghostscript.com/license.html">Licensing</a></li>
            <li><a href="https://www.ghostscript.com/releases.html">Releases</a></li>
            <li><a href="https://www.ghostscript.com/documentation.html" title="Documentation">Documentation</a></li>
            <li><a href="https://www.ghostscript.com/download.html" title="Download">Download</a></li>
            <li><a href="https://www.ghostscript.com/performance.html" title="Performance">Performance</a></li>
            <li><a href="http://jbig2dec.com/" title="jbig2dec">jbig2dec</a></li>
            <li><a href="http://git.ghostscript.com/?p=ghostpdl.git;a=summary">Source</a></li>
            <li><a href="http://bugs.ghostscript.com/">Bugs</a></li>
            <li><a href="https://www.ghostscript.com/faq.html" title="FAQ">FAQ</a></li>
        </ul>
    </div>
    </div>
    <div class="col-10 page">

<!--START EDITING HERE-->

<h2>Table of contents</h2>

<blockquote><ul>
<li><a href="#About">About Ghostscript fonts</a></li>
<li><a href="#Free_fonts">Ghostscript's free fonts</a></li>
<li><a href="#Get_fonts">How Ghostscript gets fonts when it runs</a></li>
<li><a href="#Platform_fonts">Platform fonts</a></li>
<li><a href="#Add_fonts">Adding your own fonts</a></li>
<ul>
<li><a href="#Convert_BDF">Converting BDF fonts</a></li>
</ul>
<li><a href="#For_developers">For developers only</a></li>
<li><a href="#Use_gs_fonts_with_X">Using Ghostscript fonts on X Windows displays</a></li>
<ul>
<li><a href="#Using_xset">Using <code>xset</code></a></li>
<li><a href="#Font_permanent_installation">Permanent installation</a></li>
<ul>
<li><a href="#Configure_xfs">Configuring the <code>xfs</code> font server</a></li>
<li><a href="#Configure_Xfree86">Xfree86 display servers</a></li>
</ul>
</ul>
</ul></blockquote>

<!-- [1.2 end table of contents] =========================================== -->

<!-- [1.3 begin hint] ====================================================== -->

<p>For other information, see the <a href="Readme.htm">Ghostscript
overview</a>.</p>

<!-- [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:</p>

<ul>
<li>the fonts themselves in individual files, and</li>
<li>a file &quot;<code>Fontmap</code>&quot; that defines for
Ghostscript which file represents which font.</li>
</ul>

<p>
Additionally, the file <code>cidfmap</code> can be used
to create substitutes for CIDFonts referenced by name in Postscript and PDF jobs.
See the section on <a href="Use.htm#CIDFontSubstitution">CID Font Substitution</a>
for details. NOTE: care must be exercised since poor or incorrect output may result
from inappropriate CIDFont substitution. We therefore <strong>strongly</strong> recommend
embedding CIDFonts in your Postscript and PDF files if at all possible.</p>

<p>
The &quot;base 35&quot; fonts required for Postscript (and "base 14" required for PDF)
are Postscript Type 1 font files.</p>
<p><a name="Fontmap"></a>
When Ghostscript needs a font, it must have some way to know where to look
for it: that's the purpose of the <code>Fontmap</code> file, which
associates the names of <em>fonts</em> such as <code>/Times-Roman</code>
with the names of font <em>files</em>, such as
<code>n021003l.pfb</code>.  <code>Fontmap</code> can also create
aliases for font names, so that for instance,
<code>/NimbusNo9L-Regu</code> means the same font as
<code>/Times-Roman</code>.</p>
<p>Where a mapping in <code>Fontmap</code> maps a font name to a path/file,
the directory containing the font file is automatically added to the <code>permit
file read</code> list. For example:
<br>
<code>/Arial           (/usr/share/fonts/truetype/msttcorefonts/arial.ttf) ;</code>
<br>
will result in the path <code>/usr/share/fonts/truetype/msttcorefonts/</code> being
added to the <code>permit file read</code> list. This is done on the basis that font files
are often grouped in common directories, and rather than risk the file permissions lists
being swamped with (potentially) hundreds of individual files, it makes sense to add the
directories.
<p><b>NOTE:</b> Fontmap is processed (and the paths added to the file permissions list) during
initialisation of the Postscript interpreter, so any attempt by a Postscript job to change the
font map cannot influence the file permissions list.
<hr>

<h2><a name="Free_fonts"></a>Ghostscript's free fonts</h2>
<ul>
<li>35 commercial-quality Type 1 basic PostScript fonts -- Times,
Helvetica, Courier, Symbol, etc. -- contributed by URW++ Design and
Development Incorporated, of Hamburg, Germany
(<a href="http://www.urwpp.de/">http://www.urwpp.de/</a>).  Fontmap names
them all.</li>
</ul>
<hr>
<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 all
automatically when it runs.  Instead, as part of normal initialization
Ghostscript runs a file <code>gs_fonts.ps</code>, which arranges to load
fonts on demand using information from the font map.  To preload all of the
known fonts, invoke the procedure</p>

<blockquote><code>
loadallfonts
</code></blockquote>

<p>
The file <code>lib/prfont.ps</code> contains code to print a sample page of
a font.  Load this program by including it in the <code>gs</code>
command line or by invoking</p>

<blockquote><code>
(prfont.ps) run
</code></blockquote>

<p>
Then to produce a sampler of a particular font XYZ, invoke</p>

<blockquote><code>
/XYZ DoFont
</code></blockquote>

<p>For example,</p>

<blockquote><code>
/Times-Roman DoFont
</code></blockquote>

<p>
For more information about how Ghostscript loads fonts during execution,
see <a href="Use.htm#Font_lookup">here</a>.</p>

<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 to
other PostScript language interpreters or to ATM, including MultiMaster
fonts. Ghostscript can also use TrueType font files.</p>

<p>
To add fonts of your own, you must edit Fontmap to include at the end an
entry for your new font; the format for entries is documented
in Fontmap itself.  Since later entries in Fontmap override earlier
entries, a font you add at the end supersedes any corresponding fonts supplied
with Ghostscript and defined earlier in the file. To ensure correct output,
it is vital that entries for the &quot;base 35&quot; fonts remain intact
in the Fontmap file.</p>

<p>
In the PC world, Type 1 fonts are customarily given names ending in
<code>.PFA</code> or <code>.PFB</code>.  Ghostscript can use these
directly: you just need to make the entry in Fontmap.  If you want to use
with Ghostscript a commercial Type 1 font (such as fonts obtained in
conjunction with Adobe Type Manager), please read carefully the license that
accompanies the font to satisfy yourself that you may do so legally; we take
no responsibility for any possible violations of such licenses.  The same
applies to TrueType fonts.</p>

<h3><a name="Convert_BDF"></a>Converting BDF fonts (- deprecated!)</h3>

<p>
Ghostscript provides a way to construct a (low-quality) Type 1 font from a
bitmap font in the BDF format popular in the Unix world.  The shell script
<code>bdftops</code> (Unix) or the command file
<code>bdftops.bat</code> (DOS) converts a BDF file to a
scalable outline using <code>bdftops.ps</code> .  Run the
shell command</p>

<blockquote><code>
bdftops&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]
</code></blockquote>

<p>
The arguments have these meanings:</p>
<blockquote><table>
<tr valign="top">    <td><code>BDF_filename</code></td>
    <td>&nbsp;&nbsp;</td>
    <td>Input bitmap file in BDF format</td>
    <td>&nbsp;&nbsp;</td>
    <td>&nbsp;</td></tr>
<tr valign="top">    <td><code>AFM_file1_name</code></td>
    <td>&nbsp;</td>
    <td>AFM files giving metrics</td>
    <td>&nbsp;</td>
    <td>(Optional)</td></tr>
<tr valign="top">    <td><code>gsf_filename</code></td>
    <td>&nbsp;</td>
    <td>Output file</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td></tr>
<tr valign="top">    <td><code>fontname</code></td>
    <td>&nbsp;</td>
    <td>Name of the font</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td></tr>
<tr valign="top">    <td><code>UniqueID</code></td>
    <td>&nbsp;</td>
    <td>UniqueID (<a href="#Unique_IDs">as described below</a>)</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td></tr>
<tr valign="top">    <td><code>XUID</code></td>
    <td>&nbsp;</td>
    <td>XUID, in the form <code>n1.n2.n3...</code> (<a href="#Unique_IDs">as described below</a>)</td>
    <td>&nbsp;</td>
    <td>(Optional)</td></tr>
<tr valign="top">    <td><code>encodingname</code></td>
    <td>&nbsp;</td>
    <td>"StandardEncoding" (the default), "ISOLatin1Encoding",<br>"SymbolEncoding", "DingbatsEncoding"</td>
    <td>&nbsp;</td>
    <td>(Optional)</td></tr>
</table></blockquote>

<p>
For instance</p>

<blockquote><code>
bdftops&nbsp;pzdr.bdf&nbsp;ZapfDingbats.afm&nbsp;pzdr.gsf&nbsp;ZapfDingbats&nbsp;4100000&nbsp;1000000.1.41
</code></blockquote>

<p>
Then make an entry in Fontmap for the <code>.gsf</code>
file (<code>pzdr.gsf</code> in the example) as
<a href="#Add_fonts">described above</a>.</p>

<hr>

<h2><a name="For_developers"></a>For developers only</h2>

<p>
The rest of this document is very unlikely to be of value to ordinary
users.</p>

<h3><a name="Font_contents"></a>Contents of fonts</h3>

<p>
As noted above, Ghostscript accepts fonts in the same formats as PostScript
interpreters.  Type 0, 1, and 3 fonts are documented in the PostScript
Language Reference Manual (Second Edition); detailed documentation for Type
1 fonts appears in a separate Adobe book.  Type 2 (compressed format) fonts
are documented in separate Adobe publications.  Type 4 fonts are not
documented anywhere; they are essentially Type 1 fonts with a BuildChar or
BuildGlyph procedure.  Types 9, 10, and 11 (CIDFontType 0, 1, and 2) and
Type 32 (downloaded bitmap) fonts are documented in Adobe supplements.
Type 42 (encapsulated TrueType) fonts are documented in an Adobe
supplement; the TrueType format is documented in publications available
from Apple and Microsoft.  Ghostscript does not support Type 14 (Chameleon)
fonts, which use a proprietary Adobe format.</p>

<h3><a name="Unique_IDs"></a>Font names and unique IDs</h3>

<p>
If you create your own fonts and will use them only within your own
organization, you should use <code>UniqueID</code> values between
4000000 and 4999999.</p>

<p>
If you plan to distribute fonts, ask Adobe to assign you some UniqueIDs and
also an <code>XUID</code> for your organization. Contact</p>

<blockquote><address>
Unique ID Coordinator<br>
Adobe Developers Association<br>
Adobe Systems, Inc.<br>
345 Park Avenue<br>
San Jose, CA  95110-2704<br>
+1-408-536-9000 telephone (ADA)<br>
+1-408-536-6883 fax<br>
<a href="mailto:fontdev-person@adobe.com">fontdev-person@adobe.com</a><br>
</address></blockquote>

<p>
The XUID is a Level 2 PostScript feature that serves the same function as
the UniqueID, but is not limited to a single 24-bit integer.  The
<code>bdftops</code> program creates XUIDs of the form
"<code>[-X-&nbsp;0&nbsp;-U-]</code>" where "<code>-X-</code>" is the
organization XUID and "<code>-U-</code>" is the UniqueID.  (Aladdin
Enterprises' organization XUID, which appears in a few places in various
font-related files distributed with Ghostscript, is 107; do not use this for
your own fonts that you distribute.)</p>

<hr>

<h2><a name="Use_gs_fonts_with_X"></a>Using Ghostscript fonts on X Windows displays</h2>

<p> The &quot;Xfonts&quot; feature is no longer supported.</p>

<!-- [2.0 end contents] ==================================================== -->

<!-- [3.0 begin visible trailer] =========================================== -->
<hr>

<p>
<small>Copyright &copy; 2000-2020 Artifex Software, Inc.  All rights reserved.</small>

<p>
This software is provided AS-IS with no warranty, either express or
implied.

This software is distributed under license and may not be copied, modified
or distributed except as expressly authorized under the terms of that
license.  Refer to licensing information at <a href="https://www.artifex.com">https://www.artifex.com</a>
or contact Artifex Software, Inc.,  1305 Grant Avenue - Suite 200,
Novato, CA 94945, U.S.A., +1(415)492-9861, for further information.

<p>
<small>Ghostscript version 9.53.1, 14 September 2020

<!-- [3.0 end visible trailer] ============================================= -->

<!--FINISH EDITING HERE-->

    </div>
    </div>
    </div>

    <div class="footer">
    <div class="row">
        <div class="col-7 footleft">
        <ul>
            <li><a href="https://artifex.com/contact-us/" target="blank">CONTACT US</a></li>
            <li><a href="https://artifex.com/about-us/" target="blank">ABOUT</a></li>
            <li><a href="https://ghostscript.com/security.html">SECURITY</a></li>
        </ul>
        </div>
        <div class="col-1 footcenter">
         <ul>
           <li><a href="https://artifex.com/support/" target="blank">SUPPORT</a></li>
           <li><a href="https://artifex.com/blog/artifex/" target="blank">BLOG</a></li>
           <li><a href="https://artifex.com/privacy-policy/" target="blank">PRIVACY</a></li>
           </ul>
        </div>
        <div class="col-ft-3 footright"><img src="images/Artifex_logo.png" width="194" height="40" alt=""/> <br>
              © Copyright 2019 Artifex Software, Inc. <br>
            All rights reserved.
        </div>
          </div>
    </div>

    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="index.js"></script>
</body>
</html>