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