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