3
Juliusz Chroboczek, <jch@pps.jussieu.fr>
9
This document describes the support for fonts in X11R6.9. Installing fonts
10
(section 2., page 1) is aimed at the casual user wishing to install fonts in
11
X11R6.9 the rest of the document describes the font support in more detail.
13
We assume some familiarity with digital fonts. If anything is not clear to
14
you, please consult Appendix: Background (section 5., page 1) at the end of
15
this document for background information.
19
X includes two font systems: the original core X11 fonts system, which is
20
present in all implementations of X11, and the Xft fonts system, which may
21
not be distributed with implementations of X11 that are not based on X11R6.9
22
but will hopefully be included by them in the future
24
The core X11 fonts system is directly derived from the fonts system included
25
with X11R1 in 1987, which could only use monochrome bitmap fonts. Over the
26
years, it has been more or less happily coerced into dealing with scalable
27
fonts and rotated glyphs.
29
Xft was designed from the start to provide good support for scalable fonts,
30
and do so efficiently. Unlike the core fonts system, it supports features
31
such as anti-aliasing and sub-pixel rasterisation. Perhaps more importantly,
32
it gives applications full control over the way glyphs are rendered, making
33
fine typesetting and WYSIWIG display possible. Finally, it allows applica-
34
tions to use fonts that are not installed system-wide for displaying docu-
35
ments with embedded fonts.
37
Xft is not compatible with the core fonts system: usage of Xft requires mak-
38
ing fairly extensive changes to toolkits (user-interface libraries). While
39
X.org will continue to maintain the core fonts system, toolkit authors are
40
encouraged to switch to Xft as soon as possible.
44
This section explains how to configure both Xft and the core fonts system to
45
access newly-installed fonts.
49
Xft has no configuration mechanism itself, rather it relies upon the fontcon-
50
fig library to configure and customize fonts. That library is not specific
51
to X11R6.9 or indeed on any particular font output mechanism. This discus-
52
sion describes how fontconfig, rather than Xft, works.
54
2.1.1 Installing fonts in Xft
56
Fontconfig looks for fonts in a set of well-known directories that include
57
all of X11R6.9's standard font directories (`/usr/X11R6/lib/X11/lib/fonts/*')
58
by default) as well as a directory called `.fonts/' in the user's home direc-
59
tory. Installing a font for use by Xft applications is as simple as copying
60
a font file into one of these directories.
62
$ cp lucbr.ttf ~/.fonts/
64
Fontconfig will notice the new font at the next opportunity and rebuild its
65
list of fonts. If you want to trigger this update from the command line (for
66
example in order to globally update the system-wide Fontconfig information),
67
you may run the command `fc-cache'.
73
Fontconfig's behaviour is controlled by a set of configuration files: a sys-
74
tem-wide configuration file, `/etc/fonts/fonts.conf', and a user-specific
75
file called `.fonts.conf' in the user's home directory (this can be overrid-
76
den with the `FONTCONFIG_FILE' environment variable).
78
Every Fontconfig configuration file must start with the following boiler-
82
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
85
In addition, every Fontconfig configuration file must end with the following
90
The default Fontconfig configuration file includes the directory `~/.fonts/'
91
in the list of directories searched for font files, and this is where user-
92
specific font files should be installed. In the unlikely case that a new
93
font directory needs to be added, this can be done with the following syntax:
95
<dir>/usr/local/share/fonts/</dir>
97
Another useful option is the ability to disable anti-aliasing (font smooth-
98
ing) for selected fonts. This can be done with the following syntax:
100
<match target="font">
101
<test qual="any" name="family">
102
<string>Lucida Console</string>
104
<edit name="antialias" mode="assign">
109
Anti-aliasing can be disabled for all fonts by the following incantation:
111
<match target="font">
112
<edit name="antialias" mode="assign">
117
Xft supports sub-pixel rasterisation on LCD displays. X11R6.9 should auto-
118
matically enable this feature on laptops and when using an LCD monitor con-
119
nected with a DVI cable; you can check whether this was done by typing
121
$ xdpyinfo -ext RENDER | grep sub-pixel
123
If this doesn't print anything, you will need to configure Render for your
124
particular LCD hardware manually; this is done with the following syntax:
126
<match target="font">
127
<edit name="rgba" mode="assign">
132
The string `rgb' within the `<const>'...`</const>' specifies the order of
133
pixel components on your display, and should be changed to match your hard-
134
ware; it can be one of `rgb (normal LCD screen), `bgr' (backwards LCD
135
screen), `vrgb' (LCD screen rotated clockwise) or `vbgr' (LCD screen rotated
138
2.1.3 Configuring applications
140
Because most current applications use the core fonts system by default, it is
141
necessary to explicitly configure them to use Xft. How this is done depends
144
XTerm can be set to use Xft by using the `-fa' command line option or by set-
145
ting the `XTerm*faceName' resource:
147
XTerm*faceName: Courier
151
$ xterm -fa "Courier"
153
For applications based on GTK+ 2.0 (including GNOME 2 applications), the
154
environment variable `GDK_USE_XFT' should be set to `1':
156
$ export GDK_USE_XFT=1
158
GTK+ 2.2 uses Xft by default.
160
For KDE applications, you should select ``Anti-alias fonts'' in the ``Fonts''
161
panel of KDE's ``Control Center''. Note that this option is misnamed: it
162
switches KDE to using Xft but doesn't enable anti-aliasing in case it was
163
disabled by your Xft configuration file.
165
(What about Mozilla?)
167
2.1.4 Troubleshooting
169
If some Xft-based applications don't seem to notice the changes you are mak-
170
ing to your configuration files, they may be linked against an old version of
171
Xft. In order to fix the problem, you should relink them against a current
172
version of Xft; on most systems, it is enough to install the current version
173
of the Xft and Fontconfig libraries.
175
If, for some reason, you cannot upgrade the shared libraries, please check
176
the Xft(3) manual page included with XFree86 4.2 for the configuration mecha-
177
nisms of the previous version of Xft.
179
2.2 Configuring the core X11 fonts system
181
Installing fonts in the core system is a two step process. First, you need
182
to create a font directory that contains all the relevant font files as well
183
as some index files. You then need to inform the X server of the existence
184
of this new directory by including it in the font path.
186
2.2.1 Installing bitmap fonts
188
The X11R6.9 server can use bitmap fonts in both the cross-platform BDF format
189
and the somewhat more efficient binary PCF format. (X11R6.9 also supports
190
the obsolete SNF format.)
192
Bitmap fonts are normally distributed in the BDF format. Before installing
193
such fonts, it is desirable (but not absolutely necessary) to convert the
194
font files to the PCF format. This is done by using the command `bdftopcf',
197
$ bdftopcf courier12.bdf
199
You will then want to compress the resulting PCF font files:
203
After the fonts have been converted, you should copy all the font files that
204
you wish to make available into a arbitrary directory, say
205
`/usr/local/share/fonts/bitmap/'. You should then create the index file
206
`fonts.dir' by running the command `mkfontdir' (please see the mkfontdir(1)
207
manual page for more information):
209
$ mkdir /usr/local/share/fonts/bitmap/
210
$ cp *.pcf.gz /usr/local/share/fonts/bitmap/
211
$ mkfontdir /usr/local/share/fonts/bitmap/
213
All that remains is to tell the X server about the existence of the new font
214
directory; see Setting the server font path (section 2.2.4, page 1) below.
216
2.2.2 Installing scalable fonts
218
The X11R6.9 server supports scalable fonts in three formats: Type 1, TrueType
219
and CIDFont. This section only applies to the first two; for information on
220
CIDFonts, please see Installing CIDFonts (section 2.2.3, page 1) later in
221
this document. Previous versions also included support for the Speedo scal-
222
able font format, but that is disabled in the default builds of X11R6.9 and
223
not included in X11R7.0 and later releases.
225
Installing scalable fonts is very similar to installing bitmap fonts: you
226
create a directory with the font files, and run `mkfontdir' to create an
227
index file called `fonts.dir'.
229
There is, however, a big difference: `mkfontdir' cannot automatically recog-
230
nise scalable font files. For that reason, you must first index all the font
231
files in a file called `fonts.scale'. While this can be done by hand, it is
232
best done by using the `mkfontscale' utility.
234
$ mkfontscale /usr/local/share/fonts/Type1/
235
$ mkfontdir /usr/local/share/fonts/Type1/
237
Under some circumstances, it may be necessary to modify the `fonts.scale'
238
file generated by mkfontscale; for more information, please see the mkfont-
239
dir(1) and mkfontscale(1) manual pages and Core fonts and internationalisa-
240
tion (section 4.1, page 1) later in this document.
242
2.2.3 Installing CID-keyed fonts
244
The CID-keyed font format was designed by Adobe Systems for fonts with large
245
character sets. A CID-keyed font, or CIDFont for short, contains a collec-
246
tion of glyphs indexed by character ID (CID).
248
In order to map such glyphs to meaningful indices, Adobe provide a set of
249
CMap files. The PostScript name of a font generated from a CIDFont consists
250
of the name of the CIDFont and the name of the CMap separated by two dashes.
251
For example, the font generated from the CIDFont `Munhwa-Regular' using the
252
CMap `UniKS-UCS2-H' is called
254
Munhwa-Regular--UniKS-UCS2-H
256
The CIDFont code in X11R6.9 requires a very rigid directory structure. The
257
main directory must be called `CID' (its location defaults to
258
`/usr/X11R6/lib/X11/fonts/CID' but it may be located anywhere), and it should
259
contain a subdirectory for every CID collection. Every subdirectory must
260
contain subdirectories called CIDFont (containing the actual CIDFont files),
261
CMap (containing all the needed CMaps), AFM (containing the font metric
262
files) and CFM (initially empty). For example, in the case of the font
263
Munhwa-Regular that uses the CID collection Adobe-Korea1-0, the directory
264
structure should be as follows:
266
CID/Adobe-Korea1/CIDFont/Munhwa-Regular
267
CID/Adobe-Korea1/CMap/UniKS-UCS2-H
268
CID/Adobe-Korea1/AFM/Munhwa-Regular.afm
269
CID/Adobe-Korea1/CFM/
273
After creating this directory structure and copying the relevant files, you
274
should create a `fonts.scale' file. This file has the same format as in the
275
case of (non-CID) scalable fonts, except that its first column contains
276
PostScript font names with the extension `.cid' appended rather than actual
280
Adobe-Korea1/Munhwa-Regular--UniKS-UCS2-H.cid \
281
-adobe-munhwa-medium-r-normal--0-0-0-0-p-0-iso10646-1
283
(both names on the same line). Running `mkfontdir' creates the `fonts.dir'
286
$ cd /usr/local/share/fonts/CID
289
Finally, you should create the font metrics summary files in the directory
290
`CFM' by running the command `mkcfm':
292
$ mkcfm /usr/local/share/fonts/CID
294
If no CFM files are available, the server will still be able to use the CID
295
fonts but querying them will take a long time. You should run `mkcfm' again
296
whenever a change is made to any of the CID-keyed fonts, or when the CID-
297
keyed fonts are copied to a machine with a different architecture.
299
2.2.4 Setting the server's font path
301
The list of directories where the server looks for fonts is known as the font
302
path. Informing the server of the existence of a new font directory consists
303
of putting it on the font path.
305
The font path is an ordered list; if a client's request matches multiple
306
fonts, the first one in the font path is the one that gets used. When match-
307
ing fonts, the server makes two passes over the font path: during the first
308
pass, it searches for an exact match; during the second, it searches for
309
fonts suitable for scaling.
311
For best results, scalable fonts should appear in the font path before the
312
bitmap fonts; this way, the server will prefer bitmap fonts to scalable fonts
313
when an exact match is possible, but will avoid scaling bitmap fonts when a
314
scalable font can be used. (The `:unscaled' hack, while still supported,
315
should no longer be necessary in X11R6.9.)
317
You may check the font path of the running server by typing the command
321
2.2.4.1 Temporary modification of the font path
323
The `xset' utility may be used to modify the font path for the current ses-
324
sion. The font path is set with the command xset fp; a new element is added
325
to the front with xset +fp, and added to the end with xset fp+. For example,
327
$ xset +fp /usr/local/fonts/Type1
328
$ xset fp+ /usr/local/fonts/bitmap
330
Conversely, an element may be removed from the front of the font path with
331
`xset -fp', and removed from the end with `xset fp-'. You may reset the font
332
path to its default value with `xset fp default'.
334
For more information, please consult the xset(1) manual page.
336
2.2.4.2 Permanent modification of the font path
338
The default font path (the one used just after server startup or after `xset
339
fp default') is specified in the X server's `xorg.conf' file. It is computed
340
by appending all the directories mentioned in the `FontPath' entries of the
341
`Files' section in the order in which they appear.
343
FontPath "/usr/local/fonts/Type1"
345
FontPath "/usr/local/fonts/bitmap"
347
For more information, please consult the xorg.conf(5) manual page.
349
2.2.5 Troubleshooting
351
If you seem to be unable to use some of the fonts you have installed, the
352
first thing to check is that the `fonts.dir' files are correct and that they
353
are readable by the server (the X server usually runs as root, beware of NFS-
354
mounted font directories). If this doesn't help, it is quite possible that
355
you are trying to use a font in a format that is not supported by your
358
X11R6.9 supports the BDF, PCF, SNF, Type 1, TrueType, OpenType and CIDFont
359
font formats. However, not all X11R6.9 servers come with all the font back-
362
On most platforms, the X11R6.9 servers are modular: the font backends are
363
included in modules that are loaded at runtime. The modules to be loaded are
364
specified in the `xorg.conf' file using the `Load' directive:
368
If you have trouble installing fonts in a specific format, you may want to
369
check the server's log file in order to see whether the relevant modules are
370
properly loaded. The list of font modules distributed with X11R6.9 is as
373
o "bitmap": bitmap fonts (`*.bdf', `*.pcf' and `*.snf');
375
o "freetype": TrueType fonts (`*.ttf' and `*.ttc'), OpenType fonts
376
(`*.otf' and `*.otc') and Type 1 fonts (`*.pfa' and `*.pfb');
378
o "type1": alternate Type 1 backend (`*.pfa' and `*.pfb') and CIDFont
381
o "xtt": alternate TrueType backend (`*.ttf' and `*.ttc').
383
Please note that the argument of the `Load' directive is case-sensitive.
385
3. Fonts included with X11R6.9
387
3.1 Standard bitmap fonts
389
The Sample Implementation of X11 (SI) comes with a large number of bitmap
390
fonts, including the `fixed' family, and bitmap versions of Courier, Times,
391
Helvetica and some members of the Lucida family. In the SI, these fonts are
392
provided in the ISO 8859-1 encoding (ISO Latin Western-European).
394
In X11R6.9, a number of these fonts are provided in Unicode-encoded font
395
files instead. At build time, these fonts are split into font files encoded
396
according to legacy encodings, a process which allows us to provide the stan-
397
dard fonts in a number of regional encodings with no duplication of work.
399
For example, the font file
401
/usr/X11R6/lib/X11/fonts/misc/6x13.bdf
405
-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
407
is a Unicode-encoded version of the standard `fixed' font with added support
408
for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA and other scripts
409
plus numerous technical symbols. It contains over 2800 glyphs, covering all
410
characters of ISO 8859 parts 1-5, 7-10, 13-15, as well as all European IBM
411
and Microsoft code pages, KOI8, WGL4, and the repertoires of many other char-
414
This font is used at build time for generating the font files
422
with respective XLFDs
424
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
426
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-15
427
-misc-fixed-medium-r-normal--13-120-75-75-c-60-koi8-r
429
The standard short name `fixed' is normally an alias for
431
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
433
3.2 The ClearlyU Unicode font family
435
The ClearlyU family of fonts provides a set of 12 pt, 100 dpi proportional
436
fonts with many of the glyphs needed for Unicode text. Together, the fonts
437
contain approximately 7500 glyphs.
439
The main ClearlyU font has the XLFD
441
-mutt-clearlyu-medium-r-normal--17-120-100-100-p-101-iso10646-1
443
and resides in the font file
445
/usr/X11R6/lib/X11/fonts/misc/cu12.pcf.gz
447
Additional ClearlyU fonts include
449
-mutt-clearlyu alternate glyphs-medium-r-normal--17-120-100-100-p-91-iso10646-1
450
-mutt-clearlyu pua-medium-r-normal--17-120-100-100-p-111-iso10646-1
451
-mutt-clearlyu arabic extra-medium-r-normal--17-120-100-100-p-103-fontspecific-0
452
-mutt-clearlyu ligature-medium-r-normal--17-120-100-100-p-141-fontspecific-0
454
The Alternate Glyphs font contains additional glyph shapes that are needed
455
for certain languages. A second alternate glyph font will be provided later
456
for cases where a character has more than one commonly used alternate shape
459
The PUA font contains extra glyphs that are useful for certain rendering pur-
462
The Arabic Extra font contains the glyphs necessary for characters that don't
463
have all of their possible shapes encoded in ISO 10646. The glyphs are
464
roughly ordered according to the order of the characters in the ISO 10646
467
The Ligature font contains ligatures for various scripts that may be useful
468
for improved presentation of text.
470
3.3 Standard scalable fonts
472
X11R6.9 includes all the scalable fonts distributed with X11R6.
474
3.3.1 Standard Type 1 fonts
476
The IBM Courier set of fonts cover ISO 8859-1 and ISO 8859-2 as well as Adobe
477
Standard Encoding. These fonts have XLFD
479
-adobe-courier-medium-*-*--0-0-0-0-m-0-*-*
481
and reside in the font files
483
/usr/X11R6/lib/X11/fonts/Type1/cour*.pfa
485
The Adobe Utopia set of fonts only cover ISO 8859-1 as well as Adobe Standard
486
Encoding. These fonts have XLFD
488
-adobe-utopia-*-*-normal--0-0-0-0-p-0-iso8859-1
490
and reside in the font files
492
/usr/X11R6/lib/X11/fonts/Type1/UT*.pfa
494
Finally, X11R6.9 also comes with Type 1 versions of Bitstream Courier and
495
Charter. These fonts have XLFD
497
-bitstream-courier-*-*-normal--0-0-0-0-m-0-iso8859-1
498
-bitstream-charter-*-*-normal--0-0-0-0-p-0-iso8859-1
500
and reside in the font files
502
/usr/X11R6/lib/X11/fonts/Type1/c*bt_.pfb
504
3.4 The Bigelow & Holmes Luxi family
506
X11R6.9 includes the Luxi family of scalable fonts, in both TrueType and
507
Type 1 format. This family consists of the fonts Luxi Serif, with XLFD
509
-b&h-luxi serif-medium-*-normal--*-*-*-*-p-*-*-*
513
-b&h-luxi sans-medium-*-normal--*-*-*-*-p-*-*-*
515
and Luxi Mono, with XLFD
517
-b&h-luxi mono-medium-*-normal--*-*-*-*-m-*-*-*
519
Each of these fonts comes Roman, oblique, bold and bold oblique variants The
520
TrueType version have glyphs covering the basic ASCII Unicode range, the
521
Latin 1 range, as well as the Extended Latin range and some additional punc-
522
tuation characters. In particular, these fonts include all the glyphs needed
523
for ISO 8859 parts 1, 2, 3, 4, 9, 13 and 15, as well as all the glyphs in the
524
Adobe Standard encoding and the Windows 3.1 character set.
526
The glyph coverage of the Type 1 versions is somewhat reduced, and only cov-
527
ers ISO 8859 parts 1, 2 and 15 as well as the Adobe Standard encoding.
529
The Luxi fonts are original designs by Kris Holmes and Charles Bigelow. Luxi
530
fonts include seriffed, sans serif, and monospaced styles, in roman and
531
oblique, and normal and bold weights. The fonts share stem weight, x-height,
532
capital height, ascent and descent, for graphical harmony.
534
The character width metrics of Luxi roman and bold fonts match those of core
535
fonts bundled with popular operating and window systems.
537
The license terms for the Luxi fonts are included in the file `COPYRIGHT.BH',
538
as well as in the License document.
540
Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc. developed the
541
Luxi typeface designs in Ikarus digital format.
543
URW++ Design and Development GmbH converted the Ikarus format fonts to True-
544
Type and Type1 font programs and implemented the grid-fitting "hints" and
545
kerning tables in the Luxi fonts.
547
For more information, please contact <design@bigelowandholmes.com> or
548
<info@urwpp.de>, or consult the URW++ web site <URL:http://www.urwpp.de>.
550
An earlier version of the Luxi fonts was made available under the name
551
Lucidux. This name should no longer be used due to trademark uncertainties,
552
and all traces of the Lucidux name have been removed from X11R6.9.
554
4. More about core fonts
556
This section describes X11R6.9-specific enhancements to the core X11 fonts
559
4.1 Core fonts and internationalisation
561
The scalable font backends (Type 1 and TrueType) can automatically re-encode
562
fonts to the encoding specified in the XLFD in `fonts.dir'. For example, a
563
`fonts.dir' file can contain entries for the Type 1 Courier font such as
565
cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
566
cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-2
568
which will lead to the font being recoded to ISO 8859-1 and ISO 8859-2
571
4.1.1 The fontenc layer
573
Two of the scalable backends (Type 1 and the FreeType TrueType backend) use a
574
common fontenc layer for font re-encoding. This allows these backends to
575
share their encoding data, and allows simple configuration of new locales
576
independently of font type.
578
Please note: the X-TrueType (X-TT) backend is not included in X11R6.9. That
579
functionality has been merged into the FreeType backend.>
581
In the fontenc layer, an encoding is defined by a name (such as iso8859-1),
582
possibly a number of aliases (alternate names), and an ordered collection of
583
mappings. A mapping defines the way the encoding can be mapped into one of
584
the target encodings known to fontenc; currently, these consist of Unicode,
585
Adobe glyph names, and arbitrary TrueType ``cmap''s.
587
A number of encodings are hardwired into fontenc, and are therefore always
588
available; the hardcoded encodings cannot easily be redefined. These
591
o iso10646-1: Unicode;
593
o iso8859-1: ISO Latin-1 (Western Europe);
595
o iso8859-2: ISO Latin-2 (Eastern Europe);
597
o iso8859-3: ISO Latin-3 (Southern Europe);
599
o iso8859-4: ISO Latin-4 (Northern Europe);
601
o iso8859-5: ISO Cyrillic;
603
o iso8859-6: ISO Arabic;
605
o iso8859-7: ISO Greek;
607
o iso8859-8: ISO Hebrew;
609
o iso8859-9: ISO Latin-5 (Turkish);
611
o iso8859-10: ISO Latin-6 (Nordic);
613
o iso8859-15: ISO Latin-9, or Latin-0 (Revised Western-European);
615
o koi8-r: KOI8 Russian;
617
o koi8-u: KOI8 Ukrainian (see RFC 2319);
619
o koi8-ru: KOI8 Russian/Ukrainian;
621
o koi8-uni: KOI8 ``Unified'' (Russian, Ukrainian, and Byelorussian);
623
o koi8-e: KOI8 ``European,'' ISO-IR-111, or ECMA-Cyrillic;
625
o microsoft-symbol and apple-roman: these are only likely to be useful
626
with TrueType symbol fonts.
628
Additional encodings can be added by defining encoding files. When a font
629
encoding is requested that the fontenc layer doesn't know about, the backend
630
checks the directory in which the font file resides (not necessarily the
631
directory with fonts.dir!) for a file named `encodings.dir'. If found, this
632
file is scanned for the requested encoding, and the relevant encoding defini-
633
tion file is read in. The `mkfontdir' utility, when invoked with the `-e'
634
option followed by the name of a directory containing encoding files, can be
635
used to automatically build `encodings.dir' files. Please see the mkfont-
636
dir(1) manual page for more details.
638
A number of encoding files for common encodings are included with X11R6.9.
639
Information on writing new encoding files can be found in Format of encodings
640
directory files (section 4.1.3, page 1) and Format of encoding files (section
641
4.1.4, page 1) later in this document.
643
4.1.2 Backend-specific notes about fontenc
645
4.1.2.1 The FreeType backend
647
For TrueType and OpenType fonts, the FreeType backend scans the mappings in
648
order. Mappings with a target of PostScript are ignored; mappings with a
649
TrueType or Unicode target are checked against all the cmaps in the file.
650
The first applicable mapping is used.
652
For Type 1 fonts, the FreeType backend first searches for a mapping with a
653
target of PostScript. If one is found, it is used. Otherwise, the backend
654
searches for a mapping with target Unicode, which is then composed with a
655
built-in table mapping codes to glyph names. Note that this table only cov-
656
ers part of the Unicode code points that have been assigned names by Adobe.
658
Specifying an encoding value of adobe-fontspecific for a Type 1 font disables
659
the encoding mechanism. This is useful with symbol and incorrectly encoded
660
fonts (see Incorrectly encoded fonts (section 4.1.6, page 1) below).
662
If a suitable mapping is not found, the FreeType backend defaults to
667
The Type 1 backend behaves similarly to the FreeType backend with Type 1
668
fonts, except that it limits all encodings to 8-bit codes.
670
4.1.3 Format of encoding directory files
672
In order to use a font in an encoding that the font backend does not know
673
about, you need to have an `encodings.dir' file either in the same directory
674
as the font file used or in a system-wide location
675
(`/usr/X11R6/lib/X11/fonts/encodings/' by default).
677
The `encodings.dir' file has a similar format to `fonts.dir'. Its first line
678
specifies the number of encodings, while every successive line has two
679
columns, the name of the encoding, and the name of the encoding file; this
680
can be relative to the current directory, or absolute. Every encoding name
681
should agree with the encoding name defined in the encoding file. For exam-
685
mulearabic-0 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-0.enc
686
mulearabic-1 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-1.enc
687
mulearabic-2 /usr/X11R6/lib/X11/fonts/encodings/mulearabic-2.enc
689
The name of an encoding must be specified in the encoding file's `STARTENCOD-
690
ING' or `ALIAS' line. It is not enough to create an `encodings.dir' entry.
692
If your platform supports it (it probably does), encoding files may be com-
695
The `encoding.dir' files are best maintained by the `mkfontdir' utility.
696
Please see the mkfontdir(1) manual page for more information.
698
4.1.4 Format of encoding files
700
The encoding files are ``free form,'' i.e. any string of whitespace is equiv-
701
alent to a single space. Keywords are parsed in a non-case-sensitive manner,
702
meaning that `size', `SIZE', and `SiZE' all parse as the same keyword; on the
703
other hand, case is significant in glyph names.
705
Numbers can be written in decimal, as in `256', in hexadecimal, as in
706
`0x100', or in octal, as in `0400'.
708
Comments are introduced by a hash sign `#'. A `#' may appear at any point in
709
a line, and all characters following the `#' are ignored, up to the end of
712
The encoding file starts with the definition of the name of the encoding, and
713
possibly its alternate names (aliases):
715
STARTENCODING mulearabic-0
718
The name of the encoding and its aliases should be suitable for use in an
719
XLFD font name, and therefore contain exactly one dash `-'.
721
The encoding file may then optionally declare the size of the encoding. For
722
a linear encoding (such as ISO 8859-1), the SIZE line specifies the maximum
727
For a matrix encoding, it should specify two numbers. The first is the num-
728
ber of the last row plus one, the other, the highest column number plus one.
729
In the case of `jisx0208.1990-0' (JIS X 0208(1990), double-byte encoding,
730
high bit clear), it should be
734
In the case of a matrix encoding, a `FIRSTINDEX' line may be included to
735
specify the minimum glyph index in an encoding. The keyword `FIRSTINDEX' is
736
followed by two integers, the minimum row number followed by the minimum col-
741
In the case of a linear encoding, a `FIRSTINDEX' line is not very useful. If
742
for some reason however you chose to include on, it should be followed by a
745
Note that in most font backends inclusion of a `FIRSTINDEX' line has the side
746
effect of disabling default glyph generation, and this keyword should there-
747
fore be avoided unless absolutely necessary.
749
Codes outside the region defined by the `SIZE' and `FIRSTINDEX' lines are
750
understood to be undefined. Encodings default to linear encoding with a size
751
of 256 (0x100). This means that you must declare the size of all 16 bit
754
What follows is one or more mapping sections. A mapping section starts with
755
a `STARTMAPPING' line stating the target of the mapping. The target may be
758
o Unicode (ISO 10646):
762
o a given TrueType ``cmap'':
764
STARTMAPPING cmap 3 1
766
o PostScript glyph names:
768
STARTMAPPING postscript
770
Every line in a mapping section maps one from the encoding being defined to
771
the target of the mapping. In mappings with a Unicode or TrueType mapping,
772
codes are mapped to codes:
778
As an abbreviation, it is possible to map a contiguous range of codes in a
779
single line. A line consisting of three integers
781
<it/start/ <it/end/ <it/target/
783
is an abbreviation for the range of lines
793
For example, the line
797
is an abbreviation for
804
Codes not listed are assumed to map through the identity (i.e. to the same
805
numerical value). In order to override this default mapping, you may specify
806
a range of codes to be undefined by using an `UNDEFINE' line:
810
or, for a single code,
814
PostScript mappings are different. Every line in a PostScript mapping maps a
821
and codes not explicitly listed are undefined.
823
A mapping section ends with an ENDMAPPING line
827
After all the mappings have been defined, the file ends with an ENDENCODING
832
In order to make future extensions to the format possible, lines starting
833
with an unknown keyword are silently ignored, as are mapping sections with an
836
4.1.5 Using symbol fonts
838
Type 1 symbol fonts should be installed using the adobe-fontspecific encod-
841
In an ideal world, all TrueType symbol fonts would be installed using one of
842
the microsoft-symbol and apple-roman encodings. A number of symbol fonts,
843
however, are not marked as such; such fonts should be installed using
844
microsoft-cp1252, or, for older fonts, microsoft-win3.1.
846
In order to guarantee consistent results (especially between Type 1 and True-
847
Type versions of the same font), it is possible to define a special encoding
848
for a given font. This has already been done for the ZapfDingbats font; see
849
the file `encodings/adobe-dingbats.enc'.
851
4.1.6 Hints about using badly encoded fonts
853
A number of text fonts are incorrectly encoded. Incorrect encoding is some-
854
times done by design, in order to make a font for an exotic script appear
855
like an ordinary Western text font on systems which are not easily extended
856
with new locale data. It is often the result of the font designer's laziness
857
or incompetence; for some reason, most people seem to find it easier to
858
invent idiosyncratic glyph names rather than follow the Adobe glyph list.
860
There are two ways of dealing with such fonts: using them with the encoding
861
they were designed for, and creating an ad hoc encoding file.
863
4.1.6.1 Using fonts with the designer's encoding
865
In the case of Type 1 fonts, the font designer can specify a default encod-
866
ing; this encoding is requested by using the `adobe-fontspecific' encoding in
867
the XLFD name. Sometimes, the font designer omitted to specify a reasonable
868
default encoding, in which case you should experiment with `adobe-standard',
869
`iso8859-1', `microsoft-cp1252', and `microsoft-win3.1'. (The encoding
870
`microsoft-symbol' doesn't make sense for Type 1 fonts).
872
TrueType fonts do not have a default encoding. However, most TrueType fonts
873
are designed with either Microsoft or Apple platforms in mind, so one of
874
`microsoft-symbol', `microsoft-cp1252', `microsoft-win3.1', or `apple-roman'
875
should yield reasonable results.
877
4.1.6.2 Specifying an ad hoc encoding file
879
It is always possible to define an encoding file to put the glyphs in a font
880
in any desired order. Again, see the `encodings/adobe-dingbats.enc' file to
881
see how this is done.
883
4.1.6.3 Specifying font aliases
885
By following the directions above, you will find yourself with a number of
886
fonts with unusual names --- with encodings such as `adobe-fontspecific',
887
`microsoft-win3.1' etc. In order to use these fonts with standard applica-
888
tions, it may be useful to remap them to their proper names.
890
This is done by writing a `fonts.alias' file. The format of this file is very
891
simple: it consists of a series of lines each mapping an alias name to a font
892
name. A `fonts.alias' file might look as follows:
894
"-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-iso8859-2" \
895
"-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific"
897
(both XLFD names on a single line). The syntax of the `fonts.alias' file is
898
more precisely described in the mkfontdir(1) manual page.
900
4.2 Additional notes about scalable core fonts
902
The FreeType (libfreetype-xtt2) backend (module `freetype', formerly known as
903
xfsft) is able to deal with both TrueType and Type 1 fonts. This puts it in
904
conflict with the X-TT and Type 1 backends respectively.
906
If both the FreeType and the Type 1 backends are loaded, the FreeType backend
907
will be used for Type 1 fonts. If both the FreeType and X-TT backends are
908
loaded, X-TT will be used for TrueType fonts.
910
4.2.1 About the FreeType backend
912
The FreeType (libfreetype-xtt2) backend (formerly xfsft) is a backend based
913
on version 2 of the FreeType library (see the FreeType web site
914
<URL:http://www.freetype.org/>) and has the X-TT functionalities for CJKV
915
support provided by the After X-TT Project (see the After X-TT Project web
916
site <URL:http://x-tt.sourceforge.jp/>). The FreeType module has support for
917
the ``fontenc'' style of internationalisation (see The fontenc layer (section
918
4.1.1, page 1)). This backend supports TrueType font files (`*.ttf'), Open-
919
Type font files (`*.otf'), TrueType Collections (`*.ttc'), OpenType Collec-
920
tions (`*.otc') and Type 1 font files (`*.pfa' and `*.pfb').
922
In order to access the faces in a TrueType Collection file, the face number
923
must be specified in the fonts.dir file before the filename, within a pair of
924
colons, or by setting the 'fn' TTCap option. For example,
926
:1:mincho.ttc -misc-pmincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
928
refers to face 1 in the `mincho.ttc' TrueType Collection file.
930
The new FreeType backend supports the extended `fonts.dir' syntax introduced
931
by X-TrueType with a number of options, collectively known as `TTCap'. A
932
`TTCap' entry follows the general syntax
936
and should be specified before the filename. The new FreeType almost per-
937
fectly supports TTCap options that are compatible with X-TT 1.4. The Auto-
938
matic Italic (`ai'), Double Strike (`ds') and Bounding box Width (`bw')
939
options are indispensable in CJKV. For example,
941
mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
942
ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0208.1990-0
943
ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0208.1990-0
944
ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0208.1990-0
945
bw=0.5:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0201.1976-0
946
bw=0.5:ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0201.1976-0
947
bw=0.5:ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0201.1976-0
948
bw=0.5:ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0201.1976-0
950
setup the complete combination of jisx0208 and jisx0201 using mincho.ttc
951
only. More information on the TTCap syntax is found on the After X-TT Pro-
952
ject page <URL:http://x-tt.sourceforge.jp/>.
954
The FreeType backend uses the fontenc layer in order to support recoding of
955
fonts; this was described in The fontenc layer (section 4.1.1, page 1) and
956
especially FreeType-specific notes about fontenc (section 4.1.2.1, page 1)
957
earlier in this document.
959
4.2.2 About the X-TrueType TrueType backend
961
The `X-TrueType' backend is a backend based on version 1 of the FreeType
962
library. X-TrueType doesn't use the `fontenc' layer for managing font encod-
963
ings, but instead uses its own database of encodings.
965
Since the functionalities for CJKV support introduced by X-TT have been
966
merged into the new FreeType backend, the X-TT backend will be removed from
967
X11R6.9's tree near the future. Therefore, the use of FreeType backend is
968
preferred over the X-TT backend.
970
General information on X-TrueType may be found at the After X-TT Project page
971
<URL:http://x-tt.sourceforge.jp/>.
973
4.2.3 Delayed glyph rasterisation
975
When loading a proportional fonts which contain a huge number of glyphs, the
976
old FreeType delayed glyph rasterisation until the time at which the glyph
977
was first used. The new FreeType (libfreetype-xtt2) has an improved `very
978
lazy' metric calculation method to speed up the process when loading TrueType
979
or OpenType fonts. Although the X-TT module also has this method, the
980
"vl=y" TTCap option must be set if you want to use it. This is the default
981
method for FreeType when it loads multi-byte fonts. Even if you use a uni-
982
code font which has tens of thousands of glyphs, this delay will not be wor-
983
risome as long as you use the new FreeType backend -- its `very lazy' method
986
The maximum error of bitmap position using `very lazy' method is 1 pixel, and
987
is the same as that of a character-cell spacing. When the X-TT backend is
988
used with the `vl=y' option, a chipped bitmap is displayed with certain
989
fonts. However, the new FreeType backend has minimal problem with this,
990
since it corrects left- and right-side bearings using `italicAngle' in the
991
TrueType/OpenType post table, and does automatic correction of bitmap posi-
992
tions when rasterisation so that chipped bitmaps are not displayed. Never-
993
theless if you don't want to use the `very lazy' method when using multi-
994
bytes fonts, set `vl=n' in the TTCap option to disable it:
996
vl=n:luxirr.ttf -b&h-Luxi Serif-medium-r-normal--0-0-0-0-p-0-iso10646-1
998
Of course, both backends also support an optimisation for character-cell
999
fonts (fonts with all glyph metrics equal, or terminal fonts). A font with
1000
an XLFD specifying a character-cell spacing `c', as in
1002
-misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
1006
fs=c:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
1008
will not compute the metric for each glyph, but instead trust the font to be
1009
a character-cell font. You are encouraged to make use of this optimisation
1010
when useful, but be warned that not all monospaced fonts are character-cell
1013
5. Appendix: background and terminology
1015
5.1 Characters and glyphs
1017
A computer text-processing system inputs keystrokes and outputs glyphs, small
1018
pictures that are assembled on paper or on a computer screen. Keystrokes and
1019
glyphs do not, in general, coincide: for example, if the system does generate
1020
ligatures, then to the sequence of two keystrokes <f><i> will typically cor-
1021
respond a single glyph. Similarly, if the system shapes Arabic glyphs in a
1022
vaguely reasonable manner, then multiple different glyphs may correspond to a
1025
The complex transformation rules from keystrokes to glyphs are usually fac-
1026
tored into two simpler transformations, from keystrokes to characters and
1027
from characters to glyphs. You may want to think of characters as the basic
1028
unit of text that is stored e.g. in the buffer of your text editor. While
1029
the definition of a character is intrinsically application-specific, a number
1030
of standardised collections of characters have been defined.
1032
A coded character set is a set of characters together with a mapping from
1033
integer codes --- known as codepoints --- to characters. Examples of coded
1034
character sets include US-ASCII, ISO 8859-1, KOI8-R, and JIS X 0208(1990).
1036
A coded character set need not use 8 bit integers to index characters. Many
1037
early systems used 6 bit character sets, while 16 bit (or more) character
1038
sets are necessary for ideographic writing systems.
1040
5.2 Font files, fonts, and XLFD
1042
Traditionally, typographers speak about typefaces and founts. A typeface is
1043
a particular style or design, such as Times Italic, while a fount is a
1044
molten-lead incarnation of a given typeface at a given size.
1046
Digital fonts come in font files. A font file contains the information nec-
1047
essary for generating glyphs of a given typeface, and applications using font
1048
files may access glyph information in an arbitrary order.
1050
Digital fonts may consist of bitmap data, in which case they are said to be
1051
bitmap fonts. They may also consist of a mathematical description of glyph
1052
shapes, in which case they are said to be scalable fonts. Common formats for
1053
scalable font files are Type 1 (sometimes incorrectly called ATM fonts or
1054
PostScript fonts), TrueType and OpenType.
1056
The glyph data in a digital font needs to be indexed somehow. How this is
1057
done depends on the font file format. In the case of Type 1 fonts, glyphs
1058
are identified by glyph names. In the case of TrueType fonts, glyphs are
1059
indexed by integers corresponding to one of a number of indexing schemes
1060
(usually Unicode --- see below).
1062
The X11 core fonts system uses the data in a font file to generate font
1063
instances, which are collections of glyphs at a given size indexed according
1064
to a given encoding.
1066
X11 core font instances are usually specified using a notation known as the X
1067
Logical Font Description (XLFD). An XLFD starts with a dash `-', and con-
1068
sists of fourteen fields separated by dashes, for example:
1070
-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1
1072
Or particular interest are the last two fields `iso8859-1', which specify the
1073
font instance's encoding.
1075
A scalable font is specified by an XLFD which contains zeroes instead of some
1078
-adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
1080
X11 font instances may also be specified by short name. Unlike an XLFD, a
1081
short name has no structure and is simply a conventional name for a font
1082
instance. Two short names are of particular interest, as the server will not
1083
start if font instances with these names cannot be opened. These are
1084
`fixed', which specifies the fallback font to use when the requested font
1085
cannot be opened, and `cursor', which specifies the set of glyphs to be used
1086
by the mouse pointer.
1088
Short names are usually implemented as aliases to XLFDs; the standard `fixed'
1089
and `cursor' aliases are defined in
1091
/usr/X11R6/lib/X11/font/misc/fonts.alias
1095
Unicode (urlnam <URL:http://www.unicode.org>) is a coded character set with
1096
the goal of uniquely identifying all characters for all scripts, current and
1097
historical. While Unicode was explicitly not designed as a glyph encoding
1098
scheme, it is often possible to use it as such.
1100
Unicode is an open character set, meaning that codepoint assignments may be
1101
added to Unicode at any time (once specified, though, an assignment can never
1102
be changed). For this reason, a Unicode font will be sparse, meaning that it
1103
only defines glyphs for a subset of the character registry of Unicode.
1105
The Unicode standard is defined in parallel with the international standard
1106
ISO 10646. Assignments in the two standards are always equivalent, and we
1107
often use the terms Unicode and ISO 10646 interchangeably.
1109
When used in the X11 core fonts system, Unicode-encoded fonts should have the
1110
last two fields of their XLFD set to `iso10646-1'.
1114
X11R6.9 comes with extensive documentation in the form of manual pages and
1115
typeset documents. Before installing fonts, you really should read the font-
1116
config(3) and mkfontdir(1) manual pages; other manual pages of interest
1117
include X(7), Xserver(1), xset(1), Xft(3), xlsfonts(1) and showfont(1). In
1118
addition, you may want to read the X Logical Font Description document, by
1119
Jim Flowers, which is provided in the file `xc/doc/xlfd.PS.Z'.
1121
The latest released version of the X11R6.9 documentation (including this doc-
1122
ument and all manual pages) can be found from current X11R6.9 documentation
1123
<URL:http://wiki.x.org/>.
1125
The comp.fonts FAQ <URL:http://www.netmeg.net/faq/computers/fonts/>, which is
1126
unfortunately no longer being maintained, contains a wealth of information
1127
about digital fonts.
1129
Xft and Fontconfig are described on Keith Packard's Fontconfig site
1130
<URL:http://www.fontconfig.org>.
1132
The xfsft home page <URL:http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/>
1133
has been superseded by this document, and is now obsolete; you may however
1134
still find some of the information that it contains useful. Joerg Pommnitz'
1135
xfsft page <URL:http://www.joerg-pommnitz.de/TrueType/xfsft.html> is the
1136
canonical source for the `ttmkfdir' utility, which is the ancestor of
1139
The author's software pages <URL:http://www.pps.jussieu.fr/~jch/software/>
1140
might or might not contain related scribbles and development versions of
1143
The documentation of X-TrueType is available from the After X-TT Project page
1144
<URL:http://x-tt.sourceforge.jp/>.
1146
A number of East-Asian CIDFonts are available from O'Reilly's FTP site
1147
<URL:ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/>.
1149
While the Unicode consortium site <URL:http://www.unicode.org> may be of
1150
interest, you are more likely to find what you need in Markus Kuhn's UTF-8
1151
and Unicode FAQ <URL:http://www.cl.cam.ac.uk/~mgk25/unicode.html>.
1153
The IANA RFC documents, available from a number of sites throughout the
1154
world, often provide interesting information about character set issues; see
1155
for example RFC 373.
1158
$XdotOrg: xserver/xorg/hw/xfree86/doc/README.fonts,v 1.4 2005/07/16 09:00:44 alanc Exp $