~ubuntu-branches/ubuntu/saucy/xorg-docs/saucy

« back to all changes in this revision

Viewing changes to sgml/fonts.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2009-01-19 19:53:29 UTC
  • mfrom: (3.1.3 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090119195329-yzysic30lu3pzyoy
Tags: 1:1.4-4
* Add upstream URL to the copyright file (closes: #512132).
* Upload with the upstream tarball.  For some reason this package had gone
  native.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.2//EN" [
2
 
<!ENTITY % defs SYSTEM "X11/defs.ent"> %defs;
3
 
]>
4
 
 
5
 
<Article>
6
 
 
7
 
<articleinfo>
8
 
 
9
 
<Title>Fonts in X11R</Title>
10
 
<AUTHOR><firstname>Juliusz</firstname><surname>Chroboczek</surname>
11
 
<EMAIL>jch@freedesktop.org</EMAIL>
12
 
</AUTHOR>
13
 
<PubDate>30 October 2006</PubDate>
14
 
 
15
 
</articleinfo>
16
 
 
17
 
<Sect1>
18
 
<Title>Introduction</Title>
19
 
 
20
 
<Para>
21
 
This document describes the support for fonts in X11R.
22
 
<XRef LinkEnd="sec-installing"> is aimed at the 
23
 
casual user wishing to install fonts in X11R the rest of the
24
 
document describes the font support in more detail.
25
 
</Para>
26
 
 
27
 
<Para>
28
 
We assume some familiarity with digital fonts.  If anything is not
29
 
clear to you, please consult <XRef LinkEnd="sec-background"> at the end of this document for background
30
 
information.
31
 
</Para>
32
 
 
33
 
<Sect2>
34
 
<Title>Two font systems</Title>
35
 
 
36
 
<Para>
37
 
X11 includes two font systems: the original core X11 fonts
38
 
system, which is present in all implementations of X11, and the Xft
39
 
fonts system, which may not yet be distributed with implementations of
40
 
X11 that are not based on either XFree86 or X11R6.8 or later.
41
 
</Para>
42
 
 
43
 
<Para>
44
 
The core X11 fonts system is directly derived from the fonts system
45
 
included with X11R1 in 1987, which could only use monochrome bitmap
46
 
fonts.  Over the years, it has been more or less happily coerced into
47
 
dealing with scalable fonts and rotated glyphs.
48
 
</Para>
49
 
 
50
 
<Para>
51
 
Xft was designed from the start to provide good support for scalable
52
 
fonts, and to do so efficiently.  Unlike the core fonts system, it
53
 
supports features such as anti-aliasing and sub-pixel rasterisation.
54
 
Perhaps more importantly, it gives applications full control over the
55
 
way glyphs are rendered, making fine typesetting and WYSIWIG display
56
 
possible.  Finally, it allows applications to use fonts that are not
57
 
installed system-wide for displaying documents with embedded fonts.
58
 
</Para>
59
 
 
60
 
<Para>
61
 
Xft is not compatible with the core fonts system: usage of Xft
62
 
requires fairly extensive changes to toolkits (user-interface
63
 
libraries).  While X.Org will continue to maintain the core fonts
64
 
system, toolkit authors are encouraged to switch to Xft as soon as
65
 
possible.
66
 
</Para>
67
 
 
68
 
</Sect2>
69
 
 
70
 
</Sect1>
71
 
 
72
 
<Sect1 id="sec-installing" xreflabel="Installing fonts">
73
 
<Title>Installing fonts</Title>
74
 
 
75
 
<Para>
76
 
This section explains how to configure both Xft and the core fonts
77
 
system to access newly-installed fonts.
78
 
</Para>
79
 
 
80
 
<Sect2 id="sec-configuring-xft">
81
 
<Title>Configuring Xft</Title>
82
 
 
83
 
<Para>
84
 
Xft has no configuration mechanism itself, it relies upon the
85
 
fontconfig library to configure and customise fonts.  That library is
86
 
not specific to the X Window system, and does not rely on any
87
 
particular font output mechanism.
88
 
</Para>
89
 
 
90
 
<Sect3>
91
 
<Title>Installing fonts in Xft</Title>
92
 
 
93
 
<Para>
94
 
Fontconfig looks for fonts in a set of well-known directories that
95
 
include all of X11R's standard font directories
96
 
(`<Literal remap="tt">/usr/X11R6/lib/X11/lib/fonts/*</Literal>') by default) as well as a
97
 
directory called `<Literal remap="tt">.fonts/</Literal>' in the user's home directory.
98
 
Installing a font for use by Xft applications is as simple
99
 
as copying a font file into one of these directories.
100
 
 
101
 
<Screen>
102
 
$ cp lucbr.ttf ~/.fonts/
103
 
</Screen>
104
 
 
105
 
Fontconfig will notice the new font at the next opportunity and rebuild its
106
 
list of fonts.  If you want to trigger this update from the command
107
 
line, you may run the command `<Literal remap="tt">fc-cache</Literal>'.
108
 
 
109
 
<Screen>
110
 
$ fc-cache
111
 
</Screen>
112
 
 
113
 
</Para>
114
 
 
115
 
<Para>
116
 
In order to globally update the system-wide Fontconfig information on
117
 
Unix systems, you will typically need to run this command as root:
118
 
 
119
 
<Screen>
120
 
$ su -c fc-cache
121
 
</Screen>
122
 
 
123
 
</Para>
124
 
 
125
 
</Sect3>
126
 
 
127
 
<Sect3>
128
 
<Title>Fine-tuning Xft</Title>
129
 
 
130
 
<Para>
131
 
Fontconfig's behaviour is controlled by a set of configuration
132
 
files: a standard configuration file, `<Literal remap="tt">/etc/fonts/fonts.conf</Literal>',
133
 
a host-specific configuration file, `<Literal remap="tt">/etc/fonts/local.conf</Literal>',
134
 
and a user-specific file called `<Literal remap="tt">.fonts.conf</Literal>' in the user's
135
 
home directory (this can be overridden with the
136
 
`<Literal remap="tt">FONTCONFIG&lowbar;FILE</Literal>' environment variable).
137
 
</Para>
138
 
 
139
 
<Para>
140
 
Every Fontconfig configuration file must start with the following
141
 
boilerplate:
142
 
 
143
 
<Screen>
144
 
&lt;?xml version="1.0"?&gt;
145
 
&lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
146
 
&lt;fontconfig&gt;
147
 
</Screen>
148
 
 
149
 
In addition, every Fontconfig configuration file must end with the
150
 
following line:
151
 
 
152
 
<Screen>
153
 
&lt;/fontconfig&gt;
154
 
</Screen>
155
 
 
156
 
</Para>
157
 
 
158
 
<Para>
159
 
The default Fontconfig configuration file includes the directory
160
 
`<Literal remap="tt">&tilde;/.fonts/</Literal>' in the list of directories searched for font
161
 
files, and this is where user-specific font files should be installed.
162
 
In the unlikely case that a new font directory needs to be added, this
163
 
can be done with the following syntax:
164
 
 
165
 
<Screen>
166
 
&lt;dir&gt;/usr/local/share/fonts/&lt;/dir&gt;
167
 
</Screen>
168
 
 
169
 
</Para>
170
 
 
171
 
<Para>
172
 
Another useful option is the ability to disable anti-aliasing (font
173
 
smoothing) for selected fonts.  This can be done with the following
174
 
syntax:
175
 
 
176
 
<Screen>
177
 
&lt;match target="font"&gt;
178
 
    &lt;test qual="any" name="family"&gt;
179
 
        &lt;string&gt;Lucida Console&lt;/string&gt;
180
 
    &lt;/test&gt;
181
 
    &lt;edit name="antialias" mode="assign"&gt;
182
 
        &lt;bool&gt;false&lt;/bool&gt;
183
 
    &lt;/edit&gt;
184
 
&lt;/match&gt;
185
 
</Screen>
186
 
 
187
 
Anti-aliasing can be disabled for all fonts by the following incantation:
188
 
 
189
 
<Screen>
190
 
&lt;match target="font"&gt;
191
 
    &lt;edit name="antialias" mode="assign"&gt;
192
 
        &lt;bool&gt;false&lt;/bool&gt;
193
 
    &lt;/edit&gt;
194
 
&lt;/match&gt;
195
 
</Screen>
196
 
 
197
 
</Para>
198
 
 
199
 
<Para>
200
 
Xft supports sub-pixel rasterisation on LCD displays.  X11R should
201
 
automatically enable this feature on laptops and when using an LCD
202
 
monitor connected with a DVI cable; you can check whether this was
203
 
done by typing
204
 
 
205
 
<Screen>
206
 
$ xdpyinfo -ext RENDER | grep sub-pixel
207
 
</Screen>
208
 
 
209
 
If this doesn't print anything, you will need to configure Render for
210
 
your particular LCD hardware manually; this is done with the following
211
 
syntax:
212
 
 
213
 
<Screen>
214
 
&lt;match target="font"&gt;
215
 
    &lt;edit name="rgba" mode="assign"&gt;
216
 
        &lt;const&gt;rgb&lt;/const&gt;
217
 
    &lt;/edit&gt;
218
 
&lt;/match&gt;
219
 
</Screen>
220
 
 
221
 
The string `<Literal remap="tt">rgb</Literal>' within the
222
 
`<Literal remap="tt">&lt;const&gt;</Literal>'...`<Literal remap="tt">&lt;/const&gt;</Literal>'
223
 
specifies the order of pixel components on your display, and should be
224
 
changed to match your hardware; it can be one of `<Literal remap="tt">rgb</Literal> (normal
225
 
LCD screen), `<Literal remap="tt">bgr</Literal>' (backwards LCD screen), `<Literal remap="tt">vrgb</Literal>' (LCD
226
 
screen rotated clockwise) or `<Literal remap="tt">vbgr</Literal>' (LCD screen rotated
227
 
counterclockwise).
228
 
</Para>
229
 
 
230
 
</Sect3>
231
 
 
232
 
<Sect3>
233
 
<Title>Configuring applications</Title>
234
 
 
235
 
<Para>
236
 
A growing number of applications use Xft in preference to the core
237
 
fonts system.  Some applications, however, need to be explicitly
238
 
configured to use Xft.
239
 
</Para>
240
 
 
241
 
<Para>
242
 
A case in point is XTerm, which can be set to use Xft by using the
243
 
`<Literal remap="tt">-fa</Literal>' command line option or by setting the `<Literal remap="tt">XTerm*faceName</Literal>'
244
 
resource:
245
 
 
246
 
<Screen>
247
 
XTerm*faceName: Courier
248
 
</Screen>
249
 
 
250
 
or
251
 
 
252
 
<Screen>
253
 
$ xterm -fa "Courier"
254
 
</Screen>
255
 
 
256
 
</Para>
257
 
 
258
 
<Para>
259
 
For KDE applications, you should select ``Anti-alias fonts'' in the
260
 
``Fonts'' panel of KDE's ``Control Center''.  Note that this option is
261
 
misnamed: it switches KDE to using Xft but doesn't enable
262
 
anti-aliasing in case it was disabled by your Xft configuration file.
263
 
</Para>
264
 
 
265
 
<Para>
266
 
Gnome applications and Mozilla Firefox will use Xft by default.
267
 
</Para>
268
 
 
269
 
</Sect3>
270
 
 
271
 
</Sect2>
272
 
 
273
 
<Sect2>
274
 
<Title>Configuring the core X11 fonts system</Title>
275
 
 
276
 
<Para>
277
 
Installing fonts in the core system is a two step process.  First,
278
 
you need to create a <Emphasis remap="it">font directory</Emphasis> that contains all the
279
 
relevant font files as well as some index files.  You then need to
280
 
inform the X server of the existence of this new directory by
281
 
including it in the <Emphasis remap="it">font path</Emphasis>.
282
 
</Para>
283
 
 
284
 
<Sect3>
285
 
<Title>Installing bitmap fonts</Title>
286
 
 
287
 
<Para>
288
 
The X11R server can use bitmap fonts in both the cross-platform
289
 
BDF format and the somewhat more efficient binary PCF format.
290
 
(X11R also supports the obsolete SNF format.)
291
 
</Para>
292
 
 
293
 
<Para>
294
 
Bitmap fonts are normally distributed in the BDF format.  Before
295
 
installing such fonts, it is desirable (but not absolutely necessary)
296
 
to convert the font files to the PCF format.  This is done by using the
297
 
command `<Literal remap="tt">bdftopcf</Literal>', <Emphasis remap="it">e.g.</Emphasis> 
298
 
 
299
 
<Screen>
300
 
$ bdftopcf courier12.bdf
301
 
</Screen>
302
 
 
303
 
You will then want to compress the resulting PCF font files:
304
 
 
305
 
<Screen>
306
 
$ gzip courier12.pcf
307
 
</Screen>
308
 
 
309
 
</Para>
310
 
 
311
 
<Para>
312
 
After the fonts have been converted, you should copy all the font
313
 
files that you wish to make available into a arbitrary directory, say
314
 
`<Literal remap="tt">/usr/local/share/fonts/bitmap/</Literal>'.  You should then create the
315
 
index file `<Literal remap="tt">fonts.dir</Literal>' by running the command `<Literal remap="tt">mkfontdir</Literal>'
316
 
(please see the <ULink
317
 
URL="mkfontdir.1.html"
318
 
>mkfontdir(1)</ULink
319
 
>
320
 
manual page for more information):
321
 
 
322
 
<Screen>
323
 
$ mkdir /usr/local/share/fonts/bitmap/
324
 
$ cp *.pcf.gz /usr/local/share/fonts/bitmap/
325
 
$ mkfontdir /usr/local/share/fonts/bitmap/
326
 
</Screen>
327
 
 
328
 
</Para>
329
 
 
330
 
<Para>
331
 
All that remains is to tell the X server about the existence of the
332
 
new font directory; see <XRef LinkEnd="sec-set-font-path"> below.
333
 
</Para>
334
 
 
335
 
</Sect3>
336
 
 
337
 
<Sect3>
338
 
<Title>Installing scalable fonts</Title>
339
 
 
340
 
<Para>
341
 
The X11R server supports scalable fonts in multiple
342
 
formats, including Type&nbsp;1, TrueType, OpenType/CFF and CIDFont.
343
 
This section only applies to the first three; for information on
344
 
CIDFonts, please see <XRef LinkEnd="sec-cid-fonts">
345
 
later in this document.  (Earlier versions of X11 also included
346
 
support for the Speedo scalable font format, but that is disabled in
347
 
the default builds of X11R6.9 and not included in X11R7.0 and later
348
 
releases.)
349
 
</Para>
350
 
 
351
 
<Para>
352
 
Installing scalable fonts is very similar to installing bitmap fonts:
353
 
you create a directory with the font files, and run `<Literal remap="tt">mkfontdir</Literal>'
354
 
to create an index file called `<Literal remap="tt">fonts.dir</Literal>'.
355
 
</Para>
356
 
 
357
 
<Para>
358
 
There is, however, a big difference: `<Literal remap="tt">mkfontdir</Literal>' cannot
359
 
automatically recognise scalable font files.  For that reason, you
360
 
must first index all the font files in a file called
361
 
`<Literal remap="tt">fonts.scale</Literal>'.  While this can be done by hand, it is best done
362
 
by using the `<Literal remap="tt">mkfontscale</Literal>' utility.
363
 
 
364
 
<Screen>
365
 
$ mkfontscale /usr/local/share/fonts/Type1/
366
 
$ mkfontdir /usr/local/share/fonts/Type1/
367
 
</Screen>
368
 
 
369
 
Under some circumstances, it may be necessary to modify the
370
 
`<Literal remap="tt">fonts.scale</Literal>' file generated by <Literal remap="tt">mkfontscale</Literal>; for more
371
 
information, please see the <ULink
372
 
URL="mkfontdir.1.html"
373
 
>mkfontdir(1)</ULink
374
 
> and <ULink
375
 
URL="mkfontscale.1.html"
376
 
>mkfontscale(1)</ULink
377
 
> manual pages and <XRef LinkEnd="sec-internationalisation">
378
 
later in this document.
379
 
</Para>
380
 
 
381
 
</Sect3>
382
 
 
383
 
<Sect3 id="sec-cid-fonts" xreflabel="Installing CIDFonts">
384
 
<Title>Installing CID-keyed fonts </Title>
385
 
 
386
 
<Para>
387
 
The CID-keyed font format was designed by Adobe Systems for fonts
388
 
with large character sets.  The CID-keyed format is obsolete, as it
389
 
has been superseded by other formats such as OpenType/CFF; however,
390
 
support for CID-keyed fonts is still provided in X11.
391
 
</Para>
392
 
 
393
 
<Para>
394
 
A CID-keyed font, or CIDFont for short, contains a collection of
395
 
glyphs indexed by <Emphasis remap="it">character ID</Emphasis> (CID).
396
 
</Para>
397
 
 
398
 
<Para>
399
 
In order to map such glyphs to meaningful indices, Adobe provide a set
400
 
of <Emphasis remap="it">CMap</Emphasis> files.  The PostScript name of a font generated from a
401
 
CIDFont consists of the name of the CIDFont and the name of the CMap
402
 
separated by two dashes.  For example, the font generated from the
403
 
CIDFont `<Literal remap="tt">Munhwa-Regular</Literal>' using the CMap `<Literal remap="tt">UniKS-UCS2-H</Literal>' is
404
 
called
405
 
 
406
 
<Screen>
407
 
Munhwa-Regular--UniKS-UCS2-H
408
 
</Screen>
409
 
 
410
 
</Para>
411
 
 
412
 
<Para>
413
 
The CIDFont code in X11R requires a very rigid directory
414
 
structure.  The main directory must be called `<Literal remap="tt">CID</Literal>' (its location
415
 
defaults to `<Literal remap="tt">/usr/X11R6/lib/X11/fonts/CID</Literal>' but it may be
416
 
located anywhere), and it should contain a subdirectory for every CID
417
 
collection.  Every subdirectory <Emphasis remap="it">must</Emphasis> contain subdirectories
418
 
called <Literal remap="tt">CIDFont</Literal> (containing the actual CIDFont files), <Literal remap="tt">CMap</Literal>
419
 
(containing all the needed CMaps), <Literal remap="tt">AFM</Literal> (containing the font
420
 
metric files) and <Literal remap="tt">CFM</Literal> (initially empty).  For example, in the
421
 
case of the font <Literal remap="tt">Munhwa-Regular</Literal> that uses the CID collection
422
 
<Literal remap="tt">Adobe-Korea1-0</Literal>, the directory structure should be as follows:
423
 
 
424
 
<Screen>
425
 
CID/Adobe-Korea1/CIDFont/Munhwa-Regular
426
 
CID/Adobe-Korea1/CMap/UniKS-UCS2-H
427
 
CID/Adobe-Korea1/AFM/Munhwa-Regular.afm
428
 
CID/Adobe-Korea1/CFM/
429
 
CID/fonts.dir
430
 
CID/fonts.scale
431
 
</Screen>
432
 
 
433
 
</Para>
434
 
 
435
 
<Para>
436
 
After creating this directory structure and copying the relevant
437
 
files, you should create a `<Literal remap="tt">fonts.scale</Literal>' file.  This file has the
438
 
same format as in the case of (non-CID) scalable fonts, except that
439
 
its first column contains PostScript font names with the extension
440
 
`<Literal remap="tt">.cid</Literal>' appended rather than actual filenames:
441
 
 
442
 
<Screen>
443
 
1
444
 
Adobe-Korea1/Munhwa-Regular--UniKS-UCS2-H.cid \
445
 
  -adobe-munhwa-medium-r-normal--0-0-0-0-p-0-iso10646-1
446
 
</Screen>
447
 
 
448
 
(both names on the same line).  Running `<Literal remap="tt">mkfontdir</Literal>'
449
 
creates the `<Literal remap="tt">fonts.dir</Literal>' file:
450
 
 
451
 
<Screen>
452
 
$ cd /usr/local/share/fonts/CID
453
 
$ mkfontdir
454
 
</Screen>
455
 
 
456
 
</Para>
457
 
 
458
 
<Para>
459
 
Finally, you should create the font metrics summary files in the
460
 
directory `<Literal remap="tt">CFM</Literal>' by running the command `<Literal remap="tt">mkcfm</Literal>':
461
 
 
462
 
<Screen>
463
 
$ mkcfm /usr/local/share/fonts/CID
464
 
</Screen>
465
 
 
466
 
If no CFM files are available, the server will still be able to use
467
 
the CID fonts but querying them will take a long time.  You should run
468
 
`<Literal remap="tt">mkcfm</Literal>' again whenever a change is made to any of the CID-keyed
469
 
fonts, or when the CID-keyed fonts are copied to a machine with a
470
 
different architecture.
471
 
</Para>
472
 
 
473
 
</Sect3>
474
 
 
475
 
<Sect3 id="sec-set-font-path" xreflabel="Setting the server font path">
476
 
<Title>Setting the server's font path </Title>
477
 
 
478
 
<Para>
479
 
The list of directories where the server looks for fonts is known
480
 
as the <Emphasis remap="it">font path</Emphasis>.  Informing the server of the existence of a new
481
 
font directory consists of putting it on the font path.
482
 
</Para>
483
 
 
484
 
<Para>
485
 
The font path is an ordered list; if a client's request matches
486
 
multiple fonts, the first one in the font path is the one that gets
487
 
used.  When matching fonts, the server makes two passes over the font
488
 
path: during the first pass, it searches for an exact match; during
489
 
the second, it searches for fonts suitable for scaling.
490
 
</Para>
491
 
 
492
 
<Para>
493
 
For best results, scalable fonts should appear in the font path before
494
 
the bitmap fonts; this way, the server will prefer bitmap fonts to
495
 
scalable fonts when an exact match is possible, but will avoid scaling
496
 
bitmap fonts when a scalable font can be used.  (The `<Literal remap="tt">:unscaled</Literal>'
497
 
hack, while still supported, should no longer be necessary in X11R.)
498
 
</Para>
499
 
 
500
 
<Para>
501
 
You may check the font path of the running server by typing the command
502
 
 
503
 
<Screen>
504
 
$ xset q
505
 
</Screen>
506
 
 
507
 
</Para>
508
 
 
509
 
<Sect4>
510
 
<Title>Temporary modification of the font path</Title>
511
 
 
512
 
<Para>
513
 
The `<Literal remap="tt">xset</Literal>' utility may be used to modify the font path for the
514
 
current session.  The font path is set with the command <Literal remap="tt">xset fp</Literal>;
515
 
a new element is added to the front with <Literal remap="tt">xset +fp</Literal>, and added to
516
 
the end with <Literal remap="tt">xset fp+</Literal>.  For example,
517
 
 
518
 
<Screen>
519
 
$ xset +fp /usr/local/fonts/Type1
520
 
$ xset fp+ /usr/local/fonts/bitmap
521
 
</Screen>
522
 
 
523
 
</Para>
524
 
 
525
 
<Para>
526
 
Conversely, an element may be removed from the front of the font path
527
 
with `<Literal remap="tt">xset -fp</Literal>', and removed from the end with `<Literal remap="tt">xset fp-</Literal>'.
528
 
You may reset the font path to its default value with 
529
 
`<Literal remap="tt">xset fp default</Literal>'.
530
 
</Para>
531
 
 
532
 
<Para>
533
 
For more information, please consult the <ULink
534
 
URL="xset.1.html"
535
 
>xset(1)</ULink
536
 
> manual page.
537
 
</Para>
538
 
 
539
 
</Sect4>
540
 
 
541
 
<Sect4>
542
 
<Title>Permanent modification of the font path</Title>
543
 
 
544
 
<Para>
545
 
The default font path (the one used just after server startup or
546
 
after `<Literal remap="tt">xset fp default</Literal>') is specified in the X server's
547
 
`<Literal remap="tt">xorg.conf</Literal>' file.  It is computed by appending all the
548
 
directories mentioned in the `<Literal remap="tt">FontPath</Literal>' entries of the
549
 
`<Literal remap="tt">Files</Literal>' section in the order in which they appear.
550
 
 
551
 
<Screen>
552
 
FontPath "/usr/local/fonts/Type1"
553
 
...
554
 
FontPath "/usr/local/fonts/bitmap"
555
 
</Screen>
556
 
 
557
 
</Para>
558
 
 
559
 
<Para>
560
 
For more information, please consult the <ULink
561
 
URL="xorg.conf.5.html"
562
 
>xorg.conf(5)</ULink
563
 
> manual page.
564
 
</Para>
565
 
 
566
 
</Sect4>
567
 
 
568
 
</Sect3>
569
 
 
570
 
<Sect3 id="sec-troubleshooting-core">
571
 
<Title>Troubleshooting </Title>
572
 
 
573
 
<Para>
574
 
If you seem to be unable to use some of the fonts you have
575
 
installed, the first thing to check is that the `<Literal remap="tt">fonts.dir</Literal>' files
576
 
are correct and that they are readable by the server (the X server
577
 
usually runs as root, beware of NFS-mounted font directories).  If
578
 
this doesn't help, it is quite possible that you are trying to use a
579
 
font in a format that is not supported by your server.
580
 
</Para>
581
 
 
582
 
<Para>
583
 
X11R supports the BDF, PCF, SNF, Type 1, TrueType, OpenType
584
 
and CIDFont font formats.  However, not all X11R servers
585
 
come with all the font backends configured in.
586
 
</Para>
587
 
 
588
 
<Para>
589
 
On most platforms, the X11R servers are <Emphasis remap="it">modular</Emphasis>: the font
590
 
backends are included in modules that are loaded at runtime.  The
591
 
modules to be loaded are specified in the `<Literal remap="tt">xorg.conf</Literal>' file using
592
 
the `<Literal remap="tt">Load</Literal>' directive:
593
 
 
594
 
<Screen>
595
 
Load "type1"
596
 
</Screen>
597
 
 
598
 
If you have trouble installing fonts in a specific format, you may
599
 
want to check the server's log file in order to see whether the
600
 
relevant modules are properly loaded.  The list of font modules
601
 
distributed with X11R is as follows:
602
 
 
603
 
<ItemizedList>
604
 
<ListItem>
605
 
 
606
 
<Para>
607
 
 <Literal remap="tt">"bitmap"</Literal>: bitmap fonts (`<Literal remap="tt">*.bdf</Literal>', `<Literal remap="tt">*.pcf</Literal>'
608
 
and `<Literal remap="tt">*.snf</Literal>');
609
 
</Para>
610
 
</ListItem>
611
 
<ListItem>
612
 
 
613
 
<Para>
614
 
 <Literal remap="tt">"freetype"</Literal>: TrueType fonts (`<Literal remap="tt">*.ttf</Literal>' and
615
 
`<Literal remap="tt">*.ttc</Literal>'), OpenType fonts (`<Literal remap="tt">*.otf</Literal>' and `<Literal remap="tt">*.otc</Literal>') and
616
 
Type&nbsp;1 fonts (`<Literal remap="tt">*.pfa</Literal>' and `<Literal remap="tt">*.pfb</Literal>');
617
 
</Para>
618
 
</ListItem>
619
 
<ListItem>
620
 
 
621
 
<Para>
622
 
 <Literal remap="tt">"type1"</Literal>: alternate Type&nbsp;1 backend (`<Literal remap="tt">*.pfa</Literal>' and
623
 
`<Literal remap="tt">*.pfb</Literal>') and CIDFont backend;
624
 
</Para>
625
 
</ListItem>
626
 
<ListItem>
627
 
 
628
 
<Para>
629
 
 <Literal remap="tt">"xtt"</Literal>: alternate TrueType backend (`<Literal remap="tt">*.ttf</Literal>' and
630
 
`<Literal remap="tt">*.ttc</Literal>').
631
 
</Para>
632
 
</ListItem>
633
 
 
634
 
</ItemizedList>
635
 
 
636
 
Please note that the argument of the `<Literal remap="tt">Load</Literal>' directive is
637
 
case-sensitive.
638
 
</Para>
639
 
 
640
 
</Sect3>
641
 
 
642
 
</Sect2>
643
 
 
644
 
</Sect1>
645
 
 
646
 
<Sect1>
647
 
<Title>Fonts included with X11R</Title>
648
 
 
649
 
<Sect2>
650
 
<Title>Standard bitmap fonts</Title>
651
 
 
652
 
<Para>
653
 
The Sample Implementation of X11 (SI) comes with a large number of
654
 
bitmap fonts, including the `<Literal remap="tt">fixed</Literal>' family, and bitmap versions
655
 
of Courier, Times, Helvetica and some members of the Lucida family.  In
656
 
the SI, these fonts are provided in the ISO&nbsp;8859-1 encoding (ISO
657
 
Latin Western-European).
658
 
</Para>
659
 
 
660
 
<Para>
661
 
In X11R, a number of these fonts are provided in Unicode-encoded
662
 
font files instead.  At build time, these fonts are split into font
663
 
files encoded according to legacy encodings, a process which allows
664
 
us to provide the standard fonts in a number of regional encodings
665
 
with no duplication of work.
666
 
</Para>
667
 
 
668
 
<Para>
669
 
For example, the font file
670
 
 
671
 
<Screen>
672
 
/usr/X11R6/lib/X11/fonts/misc/6x13.bdf
673
 
</Screen>
674
 
 
675
 
with XLFD
676
 
 
677
 
<Screen>
678
 
-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
679
 
</Screen>
680
 
 
681
 
is a Unicode-encoded version of the standard `<Literal remap="tt">fixed</Literal>' font with
682
 
added support for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA
683
 
and other scripts plus numerous technical symbols.  It contains over
684
 
2800 glyphs, covering all characters of ISO&nbsp;8859 parts 1-5,
685
 
7-10, 13-15, as well as all European IBM and Microsoft code pages,
686
 
KOI8, WGL4, and the repertoires of many other character sets.
687
 
</Para>
688
 
 
689
 
<Para>
690
 
This font is used at build time for generating the font files
691
 
 
692
 
<Screen>
693
 
6x13-ISO8859-1.bdf
694
 
6x13-ISO8859-2.bdf
695
 
...
696
 
6x13-ISO8859-15.bdf
697
 
6x13-KOI8-R.bdf
698
 
</Screen>
699
 
 
700
 
with respective XLFDs
701
 
 
702
 
<Screen>
703
 
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
704
 
...
705
 
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-15
706
 
-misc-fixed-medium-r-normal--13-120-75-75-c-60-koi8-r
707
 
</Screen>
708
 
 
709
 
The standard short name `<Literal remap="tt">fixed</Literal>' is normally an alias for
710
 
 
711
 
<Screen>
712
 
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
713
 
</Screen>
714
 
 
715
 
</Para>
716
 
 
717
 
</Sect2>
718
 
 
719
 
<Sect2>
720
 
<Title>The ClearlyU Unicode font family</Title>
721
 
 
722
 
<Para>
723
 
The ClearlyU family of fonts provides a set of 12&nbsp;pt,
724
 
100&nbsp;dpi proportional fonts with many of the glyphs needed for
725
 
Unicode text.  Together, the fonts contain approximately 7500 glyphs.
726
 
</Para>
727
 
 
728
 
<Para>
729
 
The main ClearlyU font has the XLFD
730
 
 
731
 
<Screen>
732
 
-mutt-clearlyu-medium-r-normal--17-120-100-100-p-101-iso10646-1 
733
 
</Screen>
734
 
 
735
 
and resides in the font file
736
 
 
737
 
<Screen>
738
 
/usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz 
739
 
</Screen>
740
 
 
741
 
Additional ClearlyU fonts include
742
 
 
743
 
<Screen>
744
 
-mutt-clearlyu alternate glyphs-medium-r-normal--17-120-100-100-p-91-iso10646-1 
745
 
-mutt-clearlyu pua-medium-r-normal--17-120-100-100-p-111-iso10646-1
746
 
-mutt-clearlyu arabic extra-medium-r-normal--17-120-100-100-p-103-fontspecific-0
747
 
-mutt-clearlyu ligature-medium-r-normal--17-120-100-100-p-141-fontspecific-0
748
 
</Screen>
749
 
 
750
 
</Para>
751
 
 
752
 
<Para>
753
 
The <Emphasis remap="it">Alternate Glyphs</Emphasis> font contains additional glyph shapes that
754
 
are needed for certain languages.  A second alternate glyph font will
755
 
be provided later for cases where a character has more than one
756
 
commonly used alternate shape (<Emphasis remap="it">e.g.</Emphasis> the Urdu heh).
757
 
</Para>
758
 
 
759
 
<Para>
760
 
The <Emphasis remap="it">PUA</Emphasis> font contains extra glyphs that are useful for certain
761
 
rendering purposes.
762
 
</Para>
763
 
 
764
 
<Para>
765
 
The <Emphasis remap="it">Arabic Extra</Emphasis> font contains the glyphs necessary for
766
 
characters that don't have all of their possible shapes encoded in
767
 
ISO&nbsp;10646.  The glyphs are roughly ordered according to the order
768
 
of the characters in the ISO&nbsp;10646 standard.
769
 
</Para>
770
 
 
771
 
<Para>
772
 
The <Emphasis remap="it">Ligature</Emphasis> font contains ligatures for various scripts that
773
 
may be useful for improved presentation of text.
774
 
</Para>
775
 
 
776
 
</Sect2>
777
 
 
778
 
<Sect2>
779
 
<Title>Standard scalable fonts</Title>
780
 
 
781
 
<Para>
782
 
X11R includes all the scalable fonts distributed with X11R6.
783
 
</Para>
784
 
 
785
 
<Sect3>
786
 
<Title>Standard Type&nbsp;1 fonts</Title>
787
 
 
788
 
<Para>
789
 
The IBM Courier set of fonts cover ISO&nbsp;8859-1 and
790
 
ISO&nbsp;8859-2 as well as Adobe Standard Encoding.  These fonts have
791
 
XLFD
792
 
 
793
 
<Screen>
794
 
-adobe-courier-medium-*-*--0-0-0-0-m-0-*-*
795
 
</Screen>
796
 
 
797
 
and reside in the font files
798
 
 
799
 
<Screen>
800
 
/usr/X11R6/lib/X11/fonts/Type1/cour*.pfa
801
 
</Screen>
802
 
 
803
 
</Para>
804
 
 
805
 
<Para>
806
 
The Adobe Utopia set of fonts only cover ISO&nbsp;8859-1 as well as
807
 
Adobe Standard Encoding.  These fonts have XLFD
808
 
 
809
 
<Screen>
810
 
-adobe-utopia-*-*-normal--0-0-0-0-p-0-iso8859-1
811
 
</Screen>
812
 
 
813
 
and reside in the font files
814
 
 
815
 
<Screen>
816
 
/usr/X11R6/lib/X11/fonts/Type1/UT*.pfa
817
 
</Screen>
818
 
 
819
 
</Para>
820
 
 
821
 
<Para>
822
 
Finally, X11R also comes with Type&nbsp;1 versions of Bitstream
823
 
Courier and Charter.  These fonts have XLFD
824
 
 
825
 
<Screen>
826
 
-bitstream-courier-*-*-normal--0-0-0-0-m-0-iso8859-1
827
 
-bitstream-charter-*-*-normal--0-0-0-0-p-0-iso8859-1
828
 
</Screen>
829
 
 
830
 
and reside in the font files
831
 
 
832
 
<Screen>
833
 
/usr/X11R6/lib/X11/fonts/Type1/c*bt_.pfb
834
 
</Screen>
835
 
 
836
 
</Para>
837
 
 
838
 
</Sect3>
839
 
 
840
 
</Sect2>
841
 
 
842
 
<Sect2>
843
 
<Title>The Bigelow &amp; Holmes Luxi family</Title>
844
 
 
845
 
<Para>
846
 
X11R includes the <Emphasis remap="it">Luxi</Emphasis> family of scalable fonts, in both
847
 
TrueType and Type&nbsp;1 format.  This family consists of the fonts
848
 
<Emphasis remap="it">Luxi Serif</Emphasis>, with XLFD
849
 
 
850
 
<Screen>
851
 
-b&amp;h-luxi serif-medium-*-normal--*-*-*-*-p-*-*-*
852
 
</Screen>
853
 
 
854
 
<Emphasis remap="it">Luxi Sans</Emphasis>, with XLFD
855
 
 
856
 
<Screen>
857
 
-b&amp;h-luxi sans-medium-*-normal--*-*-*-*-p-*-*-*
858
 
</Screen>
859
 
 
860
 
and <Emphasis remap="it">Luxi Mono</Emphasis>, with XLFD
861
 
 
862
 
<Screen>
863
 
-b&amp;h-luxi mono-medium-*-normal--*-*-*-*-m-*-*-*
864
 
</Screen>
865
 
 
866
 
Each of these fonts comes Roman, oblique, bold and bold oblique variants
867
 
The TrueType version have glyphs covering the basic ASCII Unicode
868
 
range, the Latin&nbsp;1 range, as well as the <Emphasis remap="it">Extended Latin</Emphasis>
869
 
range and some additional punctuation characters.  In particular,
870
 
these fonts include all the glyphs needed for ISO&nbsp;8859 parts 1,
871
 
2, 3, 4, 9, 13 and 15, as well as all the glyphs in the Adobe Standard
872
 
encoding and the Windows 3.1 character set.
873
 
</Para>
874
 
 
875
 
<Para>
876
 
The glyph coverage of the Type&nbsp;1 versions is somewhat reduced,
877
 
and only covers ISO&nbsp;8859 parts 1, 2 and 15 as well as the Adobe
878
 
Standard encoding.
879
 
</Para>
880
 
 
881
 
<Para>
882
 
The Luxi fonts are original designs by Kris Holmes and Charles 
883
 
Bigelow.  Luxi fonts include seriffed, sans serif, and monospaced 
884
 
styles, in roman and oblique, and normal and bold weights. The fonts 
885
 
share stem weight, x-height, capital height, ascent and descent, for 
886
 
graphical harmony.
887
 
</Para>
888
 
 
889
 
<Para>
890
 
The character width metrics of Luxi roman and bold fonts match those 
891
 
of core fonts bundled with popular operating and window systems.
892
 
</Para>
893
 
 
894
 
<Para>
895
 
The license terms for the Luxi fonts are included in the file
896
 
`<Literal remap="tt">COPYRIGHT.BH</Literal>', as well as in the <ULink
897
 
URL="LICENSE.html"
898
 
>License document</ULink
899
 
>.
900
 
</Para>
901
 
 
902
 
<Para>
903
 
Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc. 
904
 
developed the Luxi typeface designs in Ikarus digital format.
905
 
</Para>
906
 
 
907
 
<Para>
908
 
URW++ Design and Development GmbH converted the Ikarus format fonts 
909
 
to TrueType and Type1 font programs and implemented the grid-fitting 
910
 
"hints" and kerning tables in the Luxi fonts.
911
 
</Para>
912
 
 
913
 
<Para>
914
 
For more information, please contact
915
 
<EMAIL
916
 
>design@bigelowandholmes.com</EMAIL
917
 
> or 
918
 
<EMAIL
919
 
>info@urwpp.de</EMAIL
920
 
>, or consult 
921
 
<ULink
922
 
URL="http://www.urwpp.de"
923
 
>the URW++ web site</ULink
924
 
>.
925
 
</Para>
926
 
 
927
 
<Para>
928
 
An earlier version of the Luxi fonts was made available under the
929
 
name <Emphasis>Lucidux</Emphasis>.  This name should no longer be used due to trademark
930
 
uncertainties, and all traces of the <Emphasis>Lucidux</Emphasis> name have been
931
 
removed from X11R.
932
 
</Para>
933
 
 
934
 
</Sect2>
935
 
 
936
 
</Sect1>
937
 
 
938
 
<Sect1 id="sec-more-core">
939
 
<Title>More about core fonts </Title>
940
 
 
941
 
<Para>
942
 
This section describes X11R-specific enhancements to the core
943
 
X11 fonts system.
944
 
</Para>
945
 
 
946
 
<Sect2 id="sec-internationalisation" xreflabel="Core fonts and
947
 
internationalisation">
948
 
<Title>Core fonts and internationalisation </Title>
949
 
 
950
 
<Para>
951
 
The scalable font backends (Type&nbsp;1 and TrueType) can
952
 
automatically re-encode fonts to the encoding specified in the
953
 
XLFD in `<Literal remap="tt">fonts.dir</Literal>'.  For example, a `<Literal remap="tt">fonts.dir</Literal>' file can
954
 
contain entries for the Type&nbsp;1 Courier font such as
955
 
 
956
 
<Screen>
957
 
cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1 
958
 
cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-2
959
 
</Screen>
960
 
 
961
 
which will lead to the font being recoded to ISO&nbsp;8859-1 and
962
 
ISO&nbsp;8859-2 respectively.
963
 
</Para>
964
 
 
965
 
<Sect3 id="sec-fontenc">
966
 
<Title>The <Emphasis remap="it">fontenc</Emphasis> layer </Title>
967
 
 
968
 
<Para>
969
 
Two of the scalable backends (Type&nbsp;1 and the
970
 
<Emphasis remap="it">FreeType</Emphasis> TrueType backend) use a common <Emphasis remap="it">fontenc</Emphasis> layer for
971
 
font re-encoding.  This allows these backends to share their encoding
972
 
data, and allows simple configuration of new locales independently of
973
 
font type.
974
 
</Para>
975
 
 
976
 
<Para>
977
 
<Emphasis remap="it">Please note:</Emphasis> the X-TrueType (X-TT) backend is not included
978
 
in X11R.  That functionality has been merged into the FreeType
979
 
backend.&#62;
980
 
</Para>
981
 
 
982
 
<Para>
983
 
In the <Emphasis remap="it">fontenc</Emphasis> layer, an encoding is defined by a name (such as
984
 
<Literal remap="tt">iso8859-1</Literal>), possibly a number of aliases (alternate names), and
985
 
an ordered collection of mappings.  A mapping defines the way the
986
 
encoding can be mapped into one of the <Emphasis remap="it">target encodings</Emphasis> known to
987
 
<Emphasis remap="it">fontenc</Emphasis>; currently, these consist of Unicode, Adobe glyph names,
988
 
and arbitrary TrueType ``cmap''s.
989
 
</Para>
990
 
 
991
 
<Para>
992
 
A number of encodings are hardwired into <Emphasis remap="it">fontenc</Emphasis>, and are
993
 
therefore always available; the hardcoded encodings cannot easily be
994
 
redefined.  These include:
995
 
 
996
 
<ItemizedList>
997
 
<ListItem>
998
 
 
999
 
<Para>
1000
 
 <Literal remap="tt">iso10646-1</Literal>: Unicode;
1001
 
</Para>
1002
 
</ListItem>
1003
 
<ListItem>
1004
 
 
1005
 
<Para>
1006
 
 <Literal remap="tt">iso8859-1</Literal>: ISO&nbsp;Latin-1 (Western Europe);
1007
 
</Para>
1008
 
</ListItem>
1009
 
<ListItem>
1010
 
 
1011
 
<Para>
1012
 
 <Literal remap="tt">iso8859-2</Literal>: ISO&nbsp;Latin-2 (Eastern Europe);
1013
 
</Para>
1014
 
</ListItem>
1015
 
<ListItem>
1016
 
 
1017
 
<Para>
1018
 
 <Literal remap="tt">iso8859-3</Literal>: ISO&nbsp;Latin-3 (Southern Europe);
1019
 
</Para>
1020
 
</ListItem>
1021
 
<ListItem>
1022
 
 
1023
 
<Para>
1024
 
 <Literal remap="tt">iso8859-4</Literal>: ISO&nbsp;Latin-4 (Northern Europe);
1025
 
</Para>
1026
 
</ListItem>
1027
 
<ListItem>
1028
 
 
1029
 
<Para>
1030
 
 <Literal remap="tt">iso8859-5</Literal>: ISO&nbsp;Cyrillic;
1031
 
</Para>
1032
 
</ListItem>
1033
 
<ListItem>
1034
 
 
1035
 
<Para>
1036
 
 <Literal remap="tt">iso8859-6</Literal>: ISO&nbsp;Arabic;
1037
 
</Para>
1038
 
</ListItem>
1039
 
<ListItem>
1040
 
 
1041
 
<Para>
1042
 
 <Literal remap="tt">iso8859-7</Literal>: ISO&nbsp;Greek;
1043
 
</Para>
1044
 
</ListItem>
1045
 
<ListItem>
1046
 
 
1047
 
<Para>
1048
 
 <Literal remap="tt">iso8859-8</Literal>: ISO&nbsp;Hebrew;
1049
 
</Para>
1050
 
</ListItem>
1051
 
<ListItem>
1052
 
 
1053
 
<Para>
1054
 
 <Literal remap="tt">iso8859-9</Literal>: ISO&nbsp;Latin-5 (Turkish);
1055
 
</Para>
1056
 
</ListItem>
1057
 
<ListItem>
1058
 
 
1059
 
<Para>
1060
 
 <Literal remap="tt">iso8859-10</Literal>: ISO&nbsp;Latin-6 (Nordic);
1061
 
</Para>
1062
 
</ListItem>
1063
 
<ListItem>
1064
 
 
1065
 
<Para>
1066
 
 <Literal remap="tt">iso8859-15</Literal>: ISO&nbsp;Latin-9, or Latin-0 (Revised
1067
 
Western-European);
1068
 
</Para>
1069
 
</ListItem>
1070
 
<ListItem>
1071
 
 
1072
 
<Para>
1073
 
 <Literal remap="tt">koi8-r</Literal>: KOI8 Russian;
1074
 
</Para>
1075
 
</ListItem>
1076
 
<ListItem>
1077
 
 
1078
 
<Para>
1079
 
 <Literal remap="tt">koi8-u</Literal>: KOI8 Ukrainian (see RFC 2319);
1080
 
</Para>
1081
 
</ListItem>
1082
 
<ListItem>
1083
 
 
1084
 
<Para>
1085
 
 <Literal remap="tt">koi8-ru</Literal>: KOI8 Russian/Ukrainian;
1086
 
</Para>
1087
 
</ListItem>
1088
 
<ListItem>
1089
 
 
1090
 
<Para>
1091
 
 <Literal remap="tt">koi8-uni</Literal>: KOI8 ``Unified'' (Russian, Ukrainian, and
1092
 
Byelorussian);
1093
 
</Para>
1094
 
</ListItem>
1095
 
<ListItem>
1096
 
 
1097
 
<Para>
1098
 
 <Literal remap="tt">koi8-e</Literal>: KOI8 ``European,'' ISO-IR-111, or ECMA-Cyrillic;
1099
 
</Para>
1100
 
</ListItem>
1101
 
<ListItem>
1102
 
 
1103
 
<Para>
1104
 
 <Literal remap="tt">microsoft-symbol</Literal> and <Literal remap="tt">apple-roman</Literal>: these are only
1105
 
likely to be useful with TrueType symbol fonts.
1106
 
</Para>
1107
 
</ListItem>
1108
 
 
1109
 
</ItemizedList>
1110
 
 
1111
 
</Para>
1112
 
 
1113
 
<Para>
1114
 
Additional encodings can be added by defining <Emphasis remap="it">encoding files</Emphasis>.
1115
 
When a font encoding is requested that the <Emphasis remap="it">fontenc</Emphasis> layer doesn't
1116
 
know about, the backend checks the directory in which the font file
1117
 
resides (not necessarily the directory with <Literal remap="tt">fonts.dir</Literal>!) for a
1118
 
file named `<Literal remap="tt">encodings.dir</Literal>'.  If found, this file is scanned for
1119
 
the requested encoding, and the relevant encoding definition file is
1120
 
read in.  The `<Literal remap="tt">mkfontdir</Literal>' utility, when invoked with the
1121
 
`<Literal remap="tt">-e</Literal>' option followed by the name of a directory containing
1122
 
encoding files, can be used to automatically build `<Literal remap="tt">encodings.dir</Literal>'
1123
 
files.  Please see the <ULink
1124
 
URL="mkfontdir.1.html"
1125
 
>mkfontdir(1)</ULink
1126
 
>
1127
 
manual page for more details.
1128
 
</Para>
1129
 
 
1130
 
<Para>
1131
 
A number of encoding files for common encodings are included with
1132
 
X11R.  Information on writing new encoding files can be found in
1133
 
<XRef LinkEnd="sec-format-encoding-directory-files"> and <XRef LinkEnd="sec-format-encoding-files"> later in this document.
1134
 
</Para>
1135
 
 
1136
 
</Sect3>
1137
 
 
1138
 
<Sect3>
1139
 
<Title>Backend-specific notes about fontenc</Title>
1140
 
 
1141
 
<Sect4 id="sec-fontenc-freetype">
1142
 
<Title>The <Emphasis remap="it">FreeType</Emphasis> backend </Title>
1143
 
 
1144
 
<Para>
1145
 
For TrueType and OpenType fonts, the FreeType backend scans the
1146
 
mappings in order.  Mappings with a target of PostScript are ignored;
1147
 
mappings with a TrueType or Unicode target are checked against all the
1148
 
cmaps in the file.  The first applicable mapping is used.
1149
 
</Para>
1150
 
 
1151
 
<Para>
1152
 
For Type&nbsp;1 fonts, the FreeType backend first searches for a
1153
 
mapping with a target of PostScript.  If one is found, it is used.
1154
 
Otherwise, the backend searches for a mapping with target Unicode,
1155
 
which is then composed with a built-in table mapping codes to glyph
1156
 
names.  Note that this table only covers part of the Unicode code
1157
 
points that have been assigned names by Adobe.
1158
 
</Para>
1159
 
 
1160
 
<Para>
1161
 
Specifying an encoding value of <Literal remap="tt">adobe-fontspecific</Literal> for a
1162
 
Type&nbsp;1 font disables the encoding mechanism.  This is useful with
1163
 
symbol and incorrectly encoded fonts (see <XRef LinkEnd="sec-incorrect-encoding"> below).
1164
 
</Para>
1165
 
 
1166
 
<Para>
1167
 
If a suitable mapping is not found, the FreeType backend defaults to
1168
 
ISO&nbsp;8859-1.
1169
 
</Para>
1170
 
 
1171
 
</Sect4>
1172
 
 
1173
 
<Sect4>
1174
 
<Title>Type&nbsp;1</Title>
1175
 
 
1176
 
<Para>
1177
 
The Type&nbsp;1 backend behaves similarly to the FreeType backend
1178
 
with Type&nbsp;1 fonts, except that it limits all encodings to 8-bit
1179
 
codes.
1180
 
</Para>
1181
 
 
1182
 
</Sect4>
1183
 
 
1184
 
</Sect3>
1185
 
 
1186
 
<Sect3 id="sec-format-encoding-directory-files" xreflabel="Format of
1187
 
encodings directory files">
1188
 
<Title>Format of encoding directory files </Title>
1189
 
 
1190
 
<Para>
1191
 
In order to use a font in an encoding that the font backend does
1192
 
not know about, you need to have an `<Literal remap="tt">encodings.dir</Literal>' file either
1193
 
in the same directory as the font file used or in a system-wide
1194
 
location (`<Literal remap="tt">/usr/X11R6/lib/X11/fonts/encodings/</Literal>' by default).
1195
 
</Para>
1196
 
 
1197
 
<Para>
1198
 
The `<Literal remap="tt">encodings.dir</Literal>' file has a similar format to
1199
 
`<Literal remap="tt">fonts.dir</Literal>'.  Its first line specifies the number of encodings,
1200
 
while every successive line has two columns, the name of the encoding,
1201
 
and the name of the encoding file; this can be relative to the current
1202
 
directory, or absolute.  Every encoding name should agree with the
1203
 
encoding name defined in the encoding file.  For example,
1204
 
</Para>
1205
 
 
1206
 
<Para>
1207
 
 
1208
 
<Screen>
1209
 
3
1210
 
mulearabic-0 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-0.enc
1211
 
mulearabic-1 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-1.enc
1212
 
mulearabic-2 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-2.enc
1213
 
</Screen>
1214
 
 
1215
 
</Para>
1216
 
 
1217
 
<Para>
1218
 
The name of an encoding <Emphasis remap="it">must</Emphasis> be specified in the encoding file's
1219
 
`<Literal remap="tt">STARTENCODING</Literal>' or `<Literal remap="tt">ALIAS</Literal>' line.  It is not enough to create
1220
 
an `<Literal remap="tt">encodings.dir</Literal>' entry.
1221
 
</Para>
1222
 
 
1223
 
<Para>
1224
 
If your platform supports it (it probably does), encoding files may be
1225
 
compressed or gzipped.
1226
 
</Para>
1227
 
 
1228
 
<Para>
1229
 
The `<Literal remap="tt">encoding.dir</Literal>' files are best maintained by the
1230
 
`<Literal remap="tt">mkfontdir</Literal>' utility.  Please see the <ULink
1231
 
URL="mkfontdir.1.html"
1232
 
>mkfontdir(1)</ULink
1233
 
> manual page for more information.
1234
 
</Para>
1235
 
 
1236
 
</Sect3>
1237
 
 
1238
 
<Sect3 id="sec-format-encoding-files" xreflabel="Format of encoding files">
1239
 
<Title>Format of encoding files </Title>
1240
 
 
1241
 
<Para>
1242
 
The encoding files are ``free form,'' <Emphasis remap="it">i.e.</Emphasis> any string of
1243
 
whitespace is equivalent to a single space.  Keywords are parsed in a
1244
 
non-case-sensitive manner, meaning that `<Literal remap="tt">size</Literal>', `<Literal remap="tt">SIZE</Literal>', and
1245
 
`<Literal remap="tt">SiZE</Literal>' all parse as the same keyword; on the other hand, case is
1246
 
significant in glyph names.
1247
 
</Para>
1248
 
 
1249
 
<Para>
1250
 
Numbers can be written in decimal, as in `<Literal remap="tt">256</Literal>', in hexadecimal,
1251
 
as in `<Literal remap="tt">0x100</Literal>', or in octal, as in `<Literal remap="tt">0400</Literal>'.
1252
 
</Para>
1253
 
 
1254
 
<Para>
1255
 
Comments are introduced by a hash sign `<Literal remap="tt">&num;</Literal>'.  A `<Literal remap="tt">&num;</Literal>' may
1256
 
appear at any point in a line, and all characters following the
1257
 
`<Literal remap="tt">&num;</Literal>' are ignored, up to the end of the line.
1258
 
</Para>
1259
 
 
1260
 
<Para>
1261
 
The encoding file starts with the definition of the name of the
1262
 
encoding, and possibly its alternate names (aliases):
1263
 
 
1264
 
<Screen>
1265
 
STARTENCODING mulearabic-0
1266
 
ALIAS arabic-0
1267
 
</Screen>
1268
 
 
1269
 
The name of the encoding and its aliases should be suitable for use in
1270
 
an XLFD font name, and therefore contain exactly one dash `<Literal remap="tt">-</Literal>'.
1271
 
</Para>
1272
 
 
1273
 
<Para>
1274
 
The encoding file may then optionally declare the size of the
1275
 
encoding.  For a linear encoding (such as ISO&nbsp;8859-1), the SIZE
1276
 
line specifies the maximum code plus one:
1277
 
 
1278
 
<Screen>
1279
 
SIZE 0x2B
1280
 
</Screen>
1281
 
 
1282
 
For a matrix encoding, it should specify two numbers.  The first is
1283
 
the number of the last row plus one, the other, the highest column
1284
 
number plus one.  In the case of `<Literal remap="tt">jisx0208.1990-0</Literal>'
1285
 
(JIS&nbsp;X&nbsp;0208(1990), double-byte encoding, high bit clear), it
1286
 
should be
1287
 
 
1288
 
<Screen>
1289
 
SIZE 0x75 0x80
1290
 
</Screen>
1291
 
 
1292
 
In the case of a matrix encoding, a `<Literal remap="tt">FIRSTINDEX</Literal>' line may be
1293
 
included to specify the minimum glyph index in an encoding.  The
1294
 
keyword `<Literal remap="tt">FIRSTINDEX</Literal>' is followed by two integers, the minimum row
1295
 
number followed by the minimum column number:
1296
 
 
1297
 
<Screen>
1298
 
FIRSTINDEX 0x20 0x20
1299
 
</Screen>
1300
 
 
1301
 
In the case of a linear encoding, a `<Literal remap="tt">FIRSTINDEX</Literal>' line is not very
1302
 
useful.  If for some reason however you chose to include on, it should
1303
 
be followed by a single integer.
1304
 
</Para>
1305
 
 
1306
 
<Para>
1307
 
Note that in most font backends inclusion of a `<Literal remap="tt">FIRSTINDEX</Literal>' line
1308
 
has the side effect of disabling default glyph generation, and this
1309
 
keyword should therefore be avoided unless absolutely necessary.
1310
 
</Para>
1311
 
 
1312
 
<Para>
1313
 
Codes outside the region defined by the `<Literal remap="tt">SIZE</Literal>' and
1314
 
`<Literal remap="tt">FIRSTINDEX</Literal>' lines are understood to be undefined.  Encodings
1315
 
default to linear encoding with a size of 256 (0x100).  This means
1316
 
that you must declare the size of all 16 bit encodings.
1317
 
</Para>
1318
 
 
1319
 
<Para>
1320
 
What follows is one or more mapping sections.  A mapping section
1321
 
starts with a `<Literal remap="tt">STARTMAPPING</Literal>' line stating the target of the mapping.
1322
 
The target may be one of:
1323
 
 
1324
 
<ItemizedList>
1325
 
<ListItem>
1326
 
 
1327
 
<Para>
1328
 
Unicode (ISO&nbsp;10646):
1329
 
 
1330
 
<Screen>
1331
 
STARTMAPPING unicode
1332
 
</Screen>
1333
 
 
1334
 
</Para>
1335
 
</ListItem>
1336
 
<ListItem>
1337
 
 
1338
 
<Para>
1339
 
a given TrueType ``cmap'':
1340
 
 
1341
 
<Screen>
1342
 
STARTMAPPING cmap 3 1
1343
 
</Screen>
1344
 
 
1345
 
</Para>
1346
 
</ListItem>
1347
 
<ListItem>
1348
 
 
1349
 
<Para>
1350
 
PostScript glyph names:
1351
 
 
1352
 
<Screen>
1353
 
STARTMAPPING postscript
1354
 
</Screen>
1355
 
 
1356
 
</Para>
1357
 
</ListItem>
1358
 
 
1359
 
</ItemizedList>
1360
 
 
1361
 
Every line in a mapping section maps one from the encoding being
1362
 
defined to the target of the mapping.  In mappings with a Unicode or
1363
 
TrueType mapping, codes are mapped to codes:
1364
 
 
1365
 
<Screen>
1366
 
0x21 0x0660
1367
 
0x22 0x0661
1368
 
...
1369
 
</Screen>
1370
 
 
1371
 
As an abbreviation, it is possible to map a contiguous range of codes
1372
 
in a single line.  A line consisting of three integers
1373
 
 
1374
 
<Screen>
1375
 
&#60;it/start/ &#60;it/end/ &#60;it/target/
1376
 
</Screen>
1377
 
 
1378
 
is an abbreviation for the range of lines
1379
 
 
1380
 
<Screen>
1381
 
<Emphasis remap="it">start</Emphasis>     <Emphasis remap="it">target</Emphasis>
1382
 
</Screen>
1383
 
 
1384
 
<Screen>
1385
 
<Emphasis remap="it">start</Emphasis>+1   <Emphasis remap="it">target</Emphasis>+1
1386
 
</Screen>
1387
 
 
1388
 
<Screen>
1389
 
...
1390
 
</Screen>
1391
 
 
1392
 
<Screen>
1393
 
<Emphasis remap="it">end</Emphasis>       <Emphasis remap="it">target</Emphasis>+<Emphasis remap="it">end</Emphasis>-<Emphasis remap="it">start</Emphasis>
1394
 
</Screen>
1395
 
 
1396
 
For example, the line
1397
 
 
1398
 
<Screen>
1399
 
0x2121 0x215F 0x8140
1400
 
</Screen>
1401
 
 
1402
 
is an abbreviation for
1403
 
 
1404
 
<Screen>
1405
 
0x2121 0x8140
1406
 
0x2122 0x8141
1407
 
...
1408
 
0x215F 0x817E
1409
 
</Screen>
1410
 
 
1411
 
Codes not listed are assumed to map through the identity (<Emphasis remap="it">i.e.</Emphasis> to
1412
 
the same numerical value).  In order to override this default mapping,
1413
 
you may specify a range of codes to be undefined by using an
1414
 
`<Literal remap="tt">UNDEFINE</Literal>' line:
1415
 
 
1416
 
<Screen>
1417
 
UNDEFINE 0x00 0x2A
1418
 
</Screen>
1419
 
 
1420
 
or, for a single code,
1421
 
 
1422
 
<Screen>
1423
 
UNDEFINE 0x1234
1424
 
</Screen>
1425
 
 
1426
 
</Para>
1427
 
 
1428
 
<Para>
1429
 
PostScript mappings are different.  Every line in a PostScript mapping
1430
 
maps a code to a glyph name
1431
 
 
1432
 
<Screen>
1433
 
0x41 A
1434
 
0x42 B
1435
 
...
1436
 
</Screen>
1437
 
 
1438
 
and codes not explicitly listed are undefined.
1439
 
</Para>
1440
 
 
1441
 
<Para>
1442
 
A mapping section ends with an <Literal remap="tt">ENDMAPPING</Literal> line
1443
 
 
1444
 
<Screen>
1445
 
ENDMAPPING
1446
 
</Screen>
1447
 
 
1448
 
After all the mappings have been defined, the file ends with an
1449
 
<Literal remap="tt">ENDENCODING</Literal> line
1450
 
 
1451
 
<Screen>
1452
 
ENDENCODING
1453
 
</Screen>
1454
 
 
1455
 
</Para>
1456
 
 
1457
 
<Para>
1458
 
In order to make future extensions to the format possible, lines
1459
 
starting with an unknown keyword are silently ignored, as are mapping
1460
 
sections with an unknown target.
1461
 
</Para>
1462
 
 
1463
 
</Sect3>
1464
 
 
1465
 
<Sect3 id="sec-symbol-fonts">
1466
 
<Title>Using symbol fonts </Title>
1467
 
 
1468
 
<Para>
1469
 
Type&nbsp;1 symbol fonts should be installed using the
1470
 
<Literal remap="tt">adobe-fontspecific</Literal> encoding.
1471
 
</Para>
1472
 
 
1473
 
<Para>
1474
 
In an ideal world, all TrueType symbol fonts would be installed using
1475
 
one of the <Literal remap="tt">microsoft-symbol</Literal> and <Literal remap="tt">apple-roman</Literal> encodings. A
1476
 
number of symbol fonts, however, are not marked as such; such fonts
1477
 
should be installed using <Literal remap="tt">microsoft-cp1252</Literal>, or, for older fonts,
1478
 
<Literal remap="tt">microsoft-win3.1</Literal>.
1479
 
</Para>
1480
 
 
1481
 
<Para>
1482
 
In order to guarantee consistent results (especially between
1483
 
Type&nbsp;1 and TrueType versions of the same font), it is possible to
1484
 
define a special encoding for a given font. This has already been done
1485
 
for the <Literal remap="tt">ZapfDingbats</Literal> font; see the file
1486
 
`<Literal remap="tt">encodings/adobe-dingbats.enc</Literal>'.
1487
 
</Para>
1488
 
 
1489
 
</Sect3>
1490
 
 
1491
 
<Sect3 id="sec-incorrect-encoding" xreflabel="Incorrectly encoded fonts">
1492
 
<Title>Hints about using badly encoded fonts </Title>
1493
 
 
1494
 
<Para>
1495
 
A number of text fonts are incorrectly encoded. Incorrect encoding
1496
 
is sometimes done by design, in order to make a font for an exotic
1497
 
script appear like an ordinary Western text font on systems which are
1498
 
not easily extended with new locale data.  It is often the result of
1499
 
the font designer's laziness or incompetence; for some reason, most
1500
 
people seem to find it easier to invent idiosyncratic glyph names
1501
 
rather than follow the Adobe glyph list.
1502
 
</Para>
1503
 
 
1504
 
<Para>
1505
 
There are two ways of dealing with such fonts: using them with the
1506
 
encoding they were designed for, and creating an <Emphasis remap="it">ad hoc</Emphasis> encoding
1507
 
file.
1508
 
</Para>
1509
 
 
1510
 
<Sect4>
1511
 
<Title>Using fonts with the designer's encoding</Title>
1512
 
 
1513
 
<Para>
1514
 
In the case of Type&nbsp;1 fonts, the font designer can specify a
1515
 
default encoding; this encoding is requested by using the
1516
 
`<Literal remap="tt">adobe-fontspecific</Literal>' encoding in the XLFD name. Sometimes, the
1517
 
font designer omitted to specify a reasonable default encoding, in
1518
 
which case you should experiment with `<Literal remap="tt">adobe-standard</Literal>',
1519
 
`<Literal remap="tt">iso8859-1</Literal>', `<Literal remap="tt">microsoft-cp1252</Literal>', and
1520
 
`<Literal remap="tt">microsoft-win3.1</Literal>'. (The encoding `<Literal remap="tt">microsoft-symbol</Literal>' doesn't
1521
 
make sense for Type&nbsp;1 fonts).
1522
 
</Para>
1523
 
 
1524
 
<Para>
1525
 
TrueType fonts do not have a default encoding.  However, most TrueType
1526
 
fonts are designed with either Microsoft or Apple platforms in mind,
1527
 
so one of `<Literal remap="tt">microsoft-symbol</Literal>', `<Literal remap="tt">microsoft-cp1252</Literal>',
1528
 
`<Literal remap="tt">microsoft-win3.1</Literal>', or `<Literal remap="tt">apple-roman</Literal>' should yield reasonable
1529
 
results.
1530
 
</Para>
1531
 
 
1532
 
</Sect4>
1533
 
 
1534
 
<Sect4>
1535
 
<Title>Specifying an <Emphasis remap="it">ad hoc</Emphasis> encoding file</Title>
1536
 
 
1537
 
<Para>
1538
 
It is always possible to define an encoding file to put the glyphs
1539
 
in a font in any desired order. Again, see the
1540
 
`<Literal remap="tt">encodings/adobe-dingbats.enc</Literal>' file to see how this is done.
1541
 
</Para>
1542
 
 
1543
 
</Sect4>
1544
 
 
1545
 
<Sect4>
1546
 
<Title>Specifying font aliases</Title>
1547
 
 
1548
 
<Para>
1549
 
By following the directions above, you will find yourself with a
1550
 
number of fonts with unusual names --- with encodings such as
1551
 
`<Literal remap="tt">adobe-fontspecific</Literal>', `<Literal remap="tt">microsoft-win3.1</Literal>' <Emphasis remap="it">etc</Emphasis>.  In order
1552
 
to use these fonts with standard applications, it may be useful to
1553
 
remap them to their proper names.
1554
 
</Para>
1555
 
 
1556
 
<Para>
1557
 
This is done by writing a `<Literal remap="tt">fonts.alias</Literal>' file. The format of this file
1558
 
is very simple: it consists of a series of lines each mapping an alias 
1559
 
name to a font name.  A `<Literal remap="tt">fonts.alias</Literal>' file might look as follows:
1560
 
 
1561
 
<Screen>
1562
 
"-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-iso8859-2" \
1563
 
  "-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific"
1564
 
</Screen>
1565
 
 
1566
 
(both XLFD names on a single line).  The syntax of the
1567
 
`<Literal remap="tt">fonts.alias</Literal>' file is more precisely described in the
1568
 
<ULink
1569
 
URL="mkfontdir.1.html"
1570
 
>mkfontdir(1)</ULink
1571
 
> manual page.
1572
 
</Para>
1573
 
 
1574
 
</Sect4>
1575
 
 
1576
 
</Sect3>
1577
 
 
1578
 
</Sect2>
1579
 
 
1580
 
<Sect2>
1581
 
<Title>Additional notes about scalable core fonts</Title>
1582
 
 
1583
 
<Para>
1584
 
The FreeType (libfreetype-xtt2) backend (module `<Literal remap="tt">freetype</Literal>',
1585
 
formerly known as <Emphasis remap="it">xfsft</Emphasis>) is able to deal with both TrueType and
1586
 
Type&nbsp;1 fonts.  This puts it in conflict with the X-TT and Type&nbsp;1
1587
 
backends respectively.
1588
 
</Para>
1589
 
 
1590
 
<Para>
1591
 
If both the FreeType and the Type&nbsp;1 backends are loaded, the
1592
 
FreeType backend will be used for Type&nbsp;1 fonts.  If both the
1593
 
FreeType and X-TT backends are loaded, X-TT will be used for TrueType
1594
 
fonts.
1595
 
</Para>
1596
 
 
1597
 
<Sect3>
1598
 
<Title>About the <Emphasis remap="it">FreeType</Emphasis> backend</Title>
1599
 
 
1600
 
<Para>
1601
 
The <Emphasis remap="it">FreeType</Emphasis> (libfreetype-xtt2) backend (formerly <Emphasis remap="it">xfsft</Emphasis>)
1602
 
is a backend based on version 2 of the FreeType library (see <ULink
1603
 
URL="http://www.freetype.org/"
1604
 
>the FreeType web site</ULink
1605
 
>) and has
1606
 
the X-TT functionalities for CJKV support provided by the After X-TT
1607
 
Project (see <ULink
1608
 
URL="http://x-tt.sourceforge.jp/"
1609
 
>the After X-TT Project web site</ULink
1610
 
>).  The <Emphasis remap="it">FreeType</Emphasis> module has support for the
1611
 
``fontenc'' style of internationalisation (see <XRef LinkEnd="sec-fontenc">).  This backend supports TrueType font files
1612
 
(`<Literal remap="tt">*.ttf</Literal>'), OpenType font files (`<Literal remap="tt">*.otf</Literal>'), TrueType Collections
1613
 
(`<Literal remap="tt">*.ttc</Literal>'), OpenType Collections (`<Literal remap="tt">*.otc</Literal>') and Type 1 font
1614
 
files (`<Literal remap="tt">*.pfa</Literal>' and `<Literal remap="tt">*.pfb</Literal>').
1615
 
</Para>
1616
 
 
1617
 
<Para>
1618
 
In order to access the faces in a TrueType Collection file, the face
1619
 
number must be specified in the fonts.dir file before the filename,
1620
 
within a pair of colons, or by setting the 'fn' TTCap option.  For example,
1621
 
</Para>
1622
 
 
1623
 
<Para>
1624
 
 
1625
 
<Screen>
1626
 
:1:mincho.ttc -misc-pmincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
1627
 
</Screen>
1628
 
 
1629
 
</Para>
1630
 
 
1631
 
<Para>
1632
 
refers to face 1 in the `<Literal remap="tt">mincho.ttc</Literal>' TrueType Collection file.
1633
 
</Para>
1634
 
 
1635
 
<Para>
1636
 
The new <Emphasis remap="it">FreeType</Emphasis> backend supports the extended
1637
 
`<Literal remap="tt">fonts.dir</Literal>' syntax introduced by X-TrueType with a number
1638
 
of options, collectively known as `TTCap'.  A `TTCap' entry follows the
1639
 
general syntax
1640
 
</Para>
1641
 
 
1642
 
<Para>
1643
 
 
1644
 
<Screen>
1645
 
option=value:
1646
 
</Screen>
1647
 
 
1648
 
</Para>
1649
 
 
1650
 
<Para>
1651
 
and should be specified before the filename.  The new <Emphasis remap="it">FreeType</Emphasis>
1652
 
almost perfectly supports TTCap options that are compatible with X-TT
1653
 
1.4.  The Automatic Italic (`<Literal remap="tt">ai</Literal>'), Double Strike (`<Literal remap="tt">ds</Literal>') and
1654
 
Bounding box Width (`<Literal remap="tt">bw</Literal>') options are indispensable in CJKV.
1655
 
For example,
1656
 
</Para>
1657
 
 
1658
 
<Para>
1659
 
 
1660
 
<Screen>
1661
 
mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
1662
 
ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0208.1990-0
1663
 
ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0208.1990-0
1664
 
ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0208.1990-0
1665
 
bw=0.5:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0201.1976-0
1666
 
bw=0.5:ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0201.1976-0
1667
 
bw=0.5:ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0201.1976-0
1668
 
bw=0.5:ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0201.1976-0
1669
 
</Screen>
1670
 
 
1671
 
</Para>
1672
 
 
1673
 
<Para>
1674
 
setup the complete combination of jisx0208 and jisx0201 using mincho.ttc
1675
 
only.  More information on the TTCap syntax is found on <ULink
1676
 
URL="http://x-tt.sourceforge.jp/"
1677
 
>the After X-TT Project page</ULink
1678
 
>.
1679
 
</Para>
1680
 
 
1681
 
<Para>
1682
 
The <Emphasis remap="it">FreeType</Emphasis> backend uses the <Emphasis remap="it">fontenc</Emphasis> layer in order to support
1683
 
recoding of fonts; this was described in <XRef LinkEnd="sec-fontenc"> and especially <XRef LinkEnd="sec-fontenc-freetype"> earlier in this document.
1684
 
</Para>
1685
 
 
1686
 
</Sect3>
1687
 
 
1688
 
<Sect3 id="sec-X-TT">
1689
 
<Title>About the <Emphasis remap="it">X-TrueType</Emphasis> TrueType backend </Title>
1690
 
 
1691
 
<Para>
1692
 
The `X-TrueType' backend is a backend based on version 1 of the FreeType
1693
 
library.  X-TrueType doesn't use the `fontenc' layer for managing font
1694
 
encodings, but instead uses its own database of encodings.
1695
 
</Para>
1696
 
 
1697
 
<Para>
1698
 
Since the functionalities for CJKV support introduced by X-TT have been
1699
 
merged into the new <Emphasis remap="it">FreeType</Emphasis> backend, the X-TT backend will be
1700
 
removed from X11R's tree near the future.  Therefore, the use of
1701
 
<Emphasis remap="it">FreeType</Emphasis> backend is preferred over the X-TT backend.
1702
 
</Para>
1703
 
 
1704
 
<Para>
1705
 
General information on X-TrueType may be found at <ULink
1706
 
URL="http://x-tt.sourceforge.jp/"
1707
 
>the After X-TT Project page</ULink
1708
 
>.
1709
 
</Para>
1710
 
 
1711
 
</Sect3>
1712
 
 
1713
 
<Sect3>
1714
 
<Title>Delayed glyph rasterisation</Title>
1715
 
 
1716
 
<Para>
1717
 
When loading a proportional fonts which contain a huge number of glyphs,
1718
 
the old <Emphasis remap="it">FreeType</Emphasis> delayed glyph rasterisation until the time at which
1719
 
the glyph was first used.   The new FreeType (libfreetype-xtt2) has an
1720
 
improved `very lazy' metric calculation method to speed up the process when
1721
 
loading TrueType or OpenType fonts.   Although the <Emphasis remap="it">X-TT</Emphasis> module also
1722
 
has this method, the "<Literal remap="tt">vl=y</Literal>" TTCap option must be set if you want to
1723
 
use it.  This is the default method for <Emphasis remap="it">FreeType</Emphasis> when it loads
1724
 
multi-byte fonts.   Even if you use a unicode font which has tens of
1725
 
thousands of glyphs, this delay will not be worrisome as long as you use
1726
 
the new <Emphasis remap="it">FreeType</Emphasis> backend -- its `very lazy' method is super-fast.
1727
 
</Para>
1728
 
 
1729
 
<Para>
1730
 
The maximum error of bitmap position using `very lazy' method is 1 pixel,
1731
 
and is the same as that of a character-cell spacing.  When the X-TT
1732
 
backend is used with the `<Literal remap="tt">vl=y</Literal>' option, a chipped bitmap is displayed
1733
 
with certain fonts.  However, the new FreeType backend has minimal problem
1734
 
with this, since it corrects left- and right-side bearings using
1735
 
`italicAngle' in the TrueType/OpenType post table, and does automatic
1736
 
correction of bitmap positions when rasterisation so that chipped bitmaps
1737
 
are not displayed.  Nevertheless if you don't want to use the `very lazy'
1738
 
method when using multi-bytes fonts, set `<Literal remap="tt">vl=n</Literal>' in the TTCap option to
1739
 
disable it:
1740
 
</Para>
1741
 
 
1742
 
<Para>
1743
 
 
1744
 
<Screen>
1745
 
vl=n:luxirr.ttf -b&amp;h-Luxi Serif-medium-r-normal--0-0-0-0-p-0-iso10646-1
1746
 
</Screen>
1747
 
 
1748
 
</Para>
1749
 
 
1750
 
<Para>
1751
 
Of course, both backends also support an optimisation for character-cell
1752
 
fonts (fonts with all glyph metrics equal, or terminal fonts).  A font
1753
 
with an XLFD specifying a character-cell spacing `<Literal remap="tt">c</Literal>', as in
1754
 
</Para>
1755
 
 
1756
 
<Para>
1757
 
 
1758
 
<Screen>
1759
 
-misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
1760
 
</Screen>
1761
 
 
1762
 
</Para>
1763
 
 
1764
 
<Para>
1765
 
or
1766
 
</Para>
1767
 
 
1768
 
<Para>
1769
 
 
1770
 
<Screen>
1771
 
fs=c:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
1772
 
</Screen>
1773
 
 
1774
 
</Para>
1775
 
 
1776
 
<Para>
1777
 
will not compute the metric for each glyph, but instead
1778
 
trust the font to be a character-cell font.  You are
1779
 
encouraged to make use of this optimisation when useful, but be warned
1780
 
that not all monospaced fonts are character-cell fonts.
1781
 
</Para>
1782
 
 
1783
 
</Sect3>
1784
 
 
1785
 
</Sect2>
1786
 
 
1787
 
</Sect1>
1788
 
 
1789
 
<Sect1 id="sec-background" xreflabel="Appendix: Background">
1790
 
<Title>Appendix: background and terminology </Title>
1791
 
 
1792
 
<Sect2>
1793
 
<Title>Characters and glyphs</Title>
1794
 
 
1795
 
<Para>
1796
 
A computer text-processing system inputs keystrokes and outputs
1797
 
<Emphasis remap="it">glyphs</Emphasis>, small pictures that are assembled on paper or on a
1798
 
computer screen.  Keystrokes and glyphs do not, in general, coincide:
1799
 
for example, if the system does generate ligatures, then to the
1800
 
sequence of two keystrokes &lt;<Literal remap="tt">f</Literal>&gt;&lt;<Literal remap="tt">i</Literal>&gt; will typically
1801
 
correspond a single glyph.  Similarly, if the system shapes Arabic
1802
 
glyphs in a vaguely reasonable manner, then multiple different glyphs
1803
 
may correspond to a single keystroke.
1804
 
</Para>
1805
 
 
1806
 
<Para>
1807
 
The complex transformation rules from keystrokes to glyphs are usually
1808
 
factored into two simpler transformations, from keystrokes to
1809
 
<Emphasis remap="it">characters</Emphasis> and from characters to glyphs.  You may want to think
1810
 
of characters as the basic unit of text that is stored <Emphasis remap="it">e.g.</Emphasis> in
1811
 
the buffer of your text editor.  While the definition of a character
1812
 
is intrinsically application-specific, a number of standardised
1813
 
collections of characters have been defined.
1814
 
</Para>
1815
 
 
1816
 
<Para>
1817
 
A <Emphasis remap="it">coded character set</Emphasis> is a set of characters together with a
1818
 
mapping from integer codes --- known as <Emphasis remap="it">codepoints</Emphasis> --- to
1819
 
characters.  Examples of coded character sets include US-ASCII,
1820
 
ISO&nbsp;8859-1, KOI8-R, and JIS&nbsp;X&nbsp;0208(1990).
1821
 
</Para>
1822
 
 
1823
 
<Para>
1824
 
A coded character set need not use 8 bit integers to index characters.
1825
 
Many early systems used 6 bit character sets, while 16 bit (or more)
1826
 
character sets are necessary for ideographic writing systems.
1827
 
</Para>
1828
 
 
1829
 
</Sect2>
1830
 
 
1831
 
<Sect2 id="sec-xlfd">
1832
 
<Title>Font files, fonts, and XLFD </Title>
1833
 
 
1834
 
<Para>
1835
 
Traditionally, typographers speak about <Emphasis remap="it">typefaces</Emphasis> and
1836
 
<Emphasis remap="it">founts</Emphasis>.  A typeface is a particular style or design, such as
1837
 
Times Italic, while a fount is a molten-lead incarnation of a given
1838
 
typeface at a given size.
1839
 
</Para>
1840
 
 
1841
 
<Para>
1842
 
Digital fonts come in <Emphasis remap="it">font files</Emphasis>.  A font file contains the
1843
 
information necessary for generating glyphs of a given typeface, and
1844
 
applications using font files may access glyph information in an
1845
 
arbitrary order.
1846
 
</Para>
1847
 
 
1848
 
<Para>
1849
 
Digital fonts may consist of bitmap data, in which case they are said
1850
 
to be <Emphasis remap="it">bitmap fonts</Emphasis>.  They may also consist of a mathematical
1851
 
description of glyph shapes, in which case they are said to be
1852
 
<Emphasis remap="it">scalable fonts</Emphasis>.  Common formats for scalable font files are
1853
 
<Emphasis remap="it">Type&nbsp;1</Emphasis> (sometimes incorrectly called <Emphasis remap="it">ATM fonts</Emphasis> or
1854
 
<Emphasis remap="it">PostScript fonts</Emphasis>), <Emphasis remap="it">TrueType</Emphasis> and <Emphasis remap="it">OpenType</Emphasis>.
1855
 
</Para>
1856
 
 
1857
 
<Para>
1858
 
The glyph data in a digital font needs to be indexed somehow.  How
1859
 
this is done depends on the font file format.  In the case of
1860
 
Type&nbsp;1 fonts, glyphs are identified by <Emphasis remap="it">glyph names</Emphasis>.  In the
1861
 
case of TrueType fonts, glyphs are indexed by integers corresponding
1862
 
to one of a number of indexing schemes (usually Unicode --- see below).
1863
 
</Para>
1864
 
 
1865
 
<Para>
1866
 
The X11 core fonts system uses the data in a font file to generate
1867
 
<Emphasis remap="it">font instances</Emphasis>, which are collections of glyphs at a given size
1868
 
indexed according to a given encoding.
1869
 
</Para>
1870
 
 
1871
 
<Para>
1872
 
X11 core font instances are usually specified using a notation known
1873
 
as the <Emphasis remap="it">X Logical Font Description</Emphasis> (XLFD).  An XLFD starts with a
1874
 
dash `<Literal remap="tt">-</Literal>', and consists of fourteen fields separated by dashes,
1875
 
for example:
1876
 
 
1877
 
<Screen>
1878
 
-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1
1879
 
</Screen>
1880
 
 
1881
 
Or particular interest are the last two fields `<Literal remap="tt">iso8859-1</Literal>', which
1882
 
specify the font instance's encoding.
1883
 
</Para>
1884
 
 
1885
 
<Para>
1886
 
A scalable font is specified by an XLFD which contains zeroes instead
1887
 
of some fields:
1888
 
 
1889
 
<Screen>
1890
 
-adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
1891
 
</Screen>
1892
 
 
1893
 
</Para>
1894
 
 
1895
 
<Para>
1896
 
X11 font instances may also be specified by short name.  Unlike an
1897
 
XLFD, a short name has no structure and is simply a conventional name
1898
 
for a font instance.  Two short names are of particular interest, as
1899
 
the server will not start if font instances with these names cannot be
1900
 
opened.  These are `<Literal remap="tt">fixed</Literal>', which specifies the fallback font to
1901
 
use when the requested font cannot be opened, and `<Literal remap="tt">cursor</Literal>', which
1902
 
specifies the set of glyphs to be used by the mouse pointer.
1903
 
</Para>
1904
 
 
1905
 
<Para>
1906
 
Short names are usually implemented as aliases to XLFDs; the
1907
 
standard `<Literal remap="tt">fixed</Literal>' and `<Literal remap="tt">cursor</Literal>' aliases are defined in
1908
 
 
1909
 
<Screen>
1910
 
/usr/X11R6/lib/X11/font/misc/fonts.alias
1911
 
</Screen>
1912
 
 
1913
 
</Para>
1914
 
 
1915
 
</Sect2>
1916
 
 
1917
 
<Sect2>
1918
 
<Title>Unicode</Title>
1919
 
 
1920
 
<Para>
1921
 
Unicode (<ULink
1922
 
URL="http://www.unicode.org"
1923
 
>&#65533;</ULink
1924
 
>) is a coded character
1925
 
set with the goal of uniquely identifying all characters for all
1926
 
scripts, current and historical.  While Unicode was explicitly not
1927
 
designed as a glyph encoding scheme, it is often possible to use it as
1928
 
such.
1929
 
</Para>
1930
 
 
1931
 
<Para>
1932
 
Unicode is an <Emphasis remap="it">open</Emphasis> character set, meaning that codepoint
1933
 
assignments may be added to Unicode at any time (once specified,
1934
 
though, an assignment can never be changed).  For this reason, a
1935
 
Unicode font will be <Emphasis remap="it">sparse</Emphasis>, meaning that it only defines glyphs
1936
 
for a subset of the character registry of Unicode.
1937
 
</Para>
1938
 
 
1939
 
<Para>
1940
 
The Unicode standard is defined in parallel with the international
1941
 
standard ISO&nbsp;10646.  Assignments in the two standards are always
1942
 
equivalent, and we often use the terms <Emphasis remap="it">Unicode</Emphasis> and
1943
 
<Emphasis remap="it">ISO&nbsp;10646</Emphasis> interchangeably.
1944
 
</Para>
1945
 
 
1946
 
<Para>
1947
 
When used in the X11 core fonts system, Unicode-encoded fonts should
1948
 
have the last two fields of their XLFD set to `<Literal remap="tt">iso10646-1</Literal>'.
1949
 
</Para>
1950
 
 
1951
 
</Sect2>
1952
 
 
1953
 
</Sect1>
1954
 
 
1955
 
<Sect1>
1956
 
<Title>References</Title>
1957
 
 
1958
 
<Para>
1959
 
X11R comes with extensive documentation in the form of manual
1960
 
pages and typeset documents.  Before installing fonts, you really should
1961
 
read the <ULink
1962
 
URL="fontconfig.3.html"
1963
 
>fontconfig(3)</ULink
1964
 
> and
1965
 
<ULink
1966
 
URL="mkfontdir.1.html"
1967
 
>mkfontdir(1)</ULink
1968
 
> manual pages; other
1969
 
manual pages of interest include <ULink
1970
 
URL="X.7.html"
1971
 
>X(7)</ULink
1972
 
>,
1973
 
<ULink
1974
 
URL="Xserver.1.html"
1975
 
>Xserver(1)</ULink
1976
 
>, <ULink
1977
 
URL="xset.1.html"
1978
 
>xset(1)</ULink
1979
 
>, <ULink
1980
 
URL="Xft.3.html"
1981
 
>Xft(3)</ULink
1982
 
>, <ULink
1983
 
URL="xlsfonts.1.html"
1984
 
>xlsfonts(1)</ULink
1985
 
> and <ULink
1986
 
URL="showfont.1.html"
1987
 
>showfont(1)</ULink
1988
 
>.  In addition, you may want to read the X Logical
1989
 
Font Description document, by Jim Flowers, which is provided in the file
1990
 
`<Literal remap="tt">xc/doc/xlfd.PS.Z</Literal>'.
1991
 
</Para>
1992
 
 
1993
 
<Para>
1994
 
The <ULink
1995
 
URL="http://www.faqs.org/faqs/by-newsgroup/comp/comp.fonts.html"
1996
 
>comp.fonts FAQ</ULink
1997
 
>, 
1998
 
which is unfortunately no longer being maintained, contains a wealth
1999
 
of information about digital fonts.
2000
 
</Para>
2001
 
 
2002
 
<Para>
2003
 
Xft and Fontconfig are described on
2004
 
<ULink
2005
 
URL="http://www.fontconfig.org"
2006
 
>Keith Packard's Fontconfig site</ULink
2007
 
>.
2008
 
</Para>
2009
 
 
2010
 
<Para>
2011
 
The 
2012
 
<ULink
2013
 
URL="http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/"
2014
 
>xfsft home page</ULink
2015
 
>
2016
 
has been superseded by this document, and is now obsolete; you may
2017
 
however still find some of the information that it contains useful.
2018
 
<ULink
2019
 
URL="http://www.joerg-pommnitz.de/TrueType/xfsft.html"
2020
 
>Joerg Pommnitz' xfsft page</ULink
2021
 
2022
 
is the canonical source for the `<Literal remap="tt">ttmkfdir</Literal>' utility, which is the
2023
 
ancestor of <Literal remap="tt">mkfontscale</Literal>.
2024
 
</Para>
2025
 
 
2026
 
<Para>
2027
 
<ULink
2028
 
URL="http://www.pps.jussieu.fr/~jch/software/"
2029
 
>The author's software pages</ULink
2030
 
>
2031
 
might or might not contain related scribbles and development versions
2032
 
of software.
2033
 
</Para>
2034
 
 
2035
 
<Para>
2036
 
The documentation of <Emphasis remap="it">X-TrueType</Emphasis> is available from <ULink
2037
 
URL="http://x-tt.sourceforge.jp/"
2038
 
>the After X-TT Project page</ULink
2039
 
>.
2040
 
</Para>
2041
 
 
2042
 
<Para>
2043
 
A number of East-Asian CIDFonts are available from 
2044
 
<ULink
2045
 
URL="ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/"
2046
 
>O'Reilly's FTP site</ULink
2047
 
>. 
2048
 
</Para>
2049
 
 
2050
 
<Para>
2051
 
While the <ULink
2052
 
URL="http://www.unicode.org"
2053
 
>Unicode consortium site</ULink
2054
 
>
2055
 
may be of interest,  you are more likely to find what you need in
2056
 
Markus Kuhn's <ULink
2057
 
URL="http://www.cl.cam.ac.uk/~mgk25/unicode.html"
2058
 
>UTF-8 and Unicode FAQ</ULink
2059
 
>.
2060
 
</Para>
2061
 
 
2062
 
<Para>
2063
 
The IANA RFC documents, available from a number of sites throughout
2064
 
the world, often provide interesting information about character set
2065
 
issues; see for example RFC&nbsp;373.
2066
 
</Para>
2067
 
 
2068
 
</Sect1>
2069
 
 
2070
 
</Article>