xenocara/doc/xorg-docs/general/fonts/fonts.xml
2012-06-09 09:07:41 +00:00

1956 lines
60 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
[
<!ENTITY % defs SYSTEM "defs.ent"> %defs;
]>
<article id='fonts'>
<articleinfo>
<title>Fonts in X11R&relvers;</title>
<releaseinfo>X Version 11, Release &fullrelvers;</releaseinfo>
<author><firstname>Juliusz</firstname><surname>Chroboczek</surname>
<email>jch@freedesktop.org</email>
</author>
<pubdate>16 March 2012</pubdate>
</articleinfo>
<sect1 id='Introduction'>
<title>Introduction</title>
<para>
This document describes the support for fonts in X11R&relvers;.
<xref linkend='Installing_fonts' xrefstyle='select: title'/> is aimed at the
casual user wishing to install fonts in X11R&relvers; the rest of the
document describes the font support in more detail.
</para>
<para>
We assume some familiarity with digital fonts. If anything is not
clear to you, please consult <xref linkend='Appendix_background_and_terminology' xrefstyle='select: title'/> at the
end of this document for background information.
</para>
<sect2 id='Two_font_systems'>
<title>Two font systems</title>
<para>
X11 includes two font systems: the original core X11 fonts
system, which is present in all implementations of X11, and the Xft
fonts system, which may not yet be distributed with implementations of
X11 that are not based on either XFree86 or X11R6.8 or later.
</para>
<para>
The core X11 fonts system is directly derived from the fonts system
included with X11R1 in 1987, which could only use monochrome bitmap
fonts. Over the years, it has been more or less happily coerced into
dealing with scalable fonts and rotated glyphs.
</para>
<para>
Xft was designed from the start to provide good support for scalable
fonts, and to do so efficiently. Unlike the core fonts system, it
supports features such as anti-aliasing and sub-pixel rasterisation.
Perhaps more importantly, it gives applications full control over the
way glyphs are rendered, making fine typesetting and WYSIWIG display
possible. Finally, it allows applications to use fonts that are not
installed system-wide for displaying documents with embedded fonts.
</para>
<para>
Xft is not compatible with the core fonts system: usage of Xft
requires fairly extensive changes to toolkits (user-interface
libraries). While X.Org will continue to maintain the core fonts
system, toolkit authors are encouraged to switch to Xft as soon as
possible.
</para>
</sect2>
</sect1>
<sect1 id='Installing_fonts'>
<title>Installing fonts</title>
<para>
This section explains how to configure both Xft and the core fonts
system to access newly-installed fonts.
</para>
<sect2 id='Configuring_Xft'>
<title>Configuring Xft</title>
<para>
Xft has no configuration mechanism itself, it relies upon the
<ulink url="http://www.fontconfig.org/">fontconfig</ulink>
library to configure and customise fonts. That library is
not specific to the X Window system, and does not rely on any
particular font output mechanism.
</para>
<sect3 id='Installing_fonts_in_Xft'>
<title>Installing fonts in Xft</title>
<para>
Fontconfig looks for fonts in a set of well-known directories that
include all of X11R&relvers;'s standard font directories
(<quote><filename>/usr/share/fonts/X11/*</filename></quote>) by default) as well as a
directory called <quote><filename>.fonts/</filename></quote> in the user's home directory.
Installing a font for use by Xft applications is as simple
as copying a font file into one of these directories.
<screen>
$ cp lucbr.ttf ~/.fonts/
</screen>
Fontconfig will notice the new font at the next opportunity and rebuild its
list of fonts. If you want to trigger this update from the command
line, you may run the command <quote><command>fc-cache</command></quote>.
<screen>
$ fc-cache
</screen>
</para>
<para>
In order to globally update the system-wide Fontconfig information on
Unix systems, you will typically need to run this command as root:
<screen>
$ su -c fc-cache
</screen>
</para>
</sect3>
<sect3 id='Fine-tuning_Xft'>
<title>Fine-tuning Xft</title>
<para>
Fontconfig's behaviour is controlled by a set of configuration
files: a standard configuration file, <quote><filename>/etc/fonts/fonts.conf</filename></quote>,
a host-specific configuration file, <quote><filename>/etc/fonts/local.conf</filename></quote>,
and a user-specific file called <quote><filename>.fonts.conf</filename></quote> in the user's
home directory (this can be overridden with the
<quote><envar>FONTCONFIG&lowbar;FILE</envar></quote> environment variable).
</para>
<para>
Every Fontconfig configuration file must start with the following
boilerplate:
<screen>
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
&lt;fontconfig&gt;
</screen>
In addition, every Fontconfig configuration file must end with the
following line:
<screen>
&lt;/fontconfig&gt;
</screen>
</para>
<para>
The default Fontconfig configuration file includes the directory
<quote><filename>&tilde;/.fonts/</filename></quote> in the list of directories searched for font
files, and this is where user-specific font files should be installed.
In the unlikely case that a new font directory needs to be added, this
can be done with the following syntax:
<screen>
&lt;dir&gt;/usr/local/share/fonts/&lt;/dir&gt;
</screen>
</para>
<para>
Another useful option is the ability to disable anti-aliasing (font
smoothing) for selected fonts. This can be done with the following
syntax:
<screen>
&lt;match target="font"&gt;
&lt;test qual="any" name="family"&gt;
&lt;string&gt;Lucida Console&lt;/string&gt;
&lt;/test&gt;
&lt;edit name="antialias" mode="assign"&gt;
&lt;bool&gt;false&lt;/bool&gt;
&lt;/edit&gt;
&lt;/match&gt;
</screen>
Anti-aliasing can be disabled for all fonts by the following incantation:
<screen>
&lt;match target="font"&gt;
&lt;edit name="antialias" mode="assign"&gt;
&lt;bool&gt;false&lt;/bool&gt;
&lt;/edit&gt;
&lt;/match&gt;
</screen>
</para>
<para>
Xft supports sub-pixel rasterisation on LCD displays. X11R&relvers; should
automatically enable this feature on laptops and when using an LCD
monitor connected with a DVI cable; you can check whether this was
done by typing
<screen>
$ xdpyinfo -ext RENDER | grep sub-pixel
</screen>
If this doesn't print anything, you will need to configure Render for
your particular LCD hardware manually; this is done with the following
syntax:
<screen>
&lt;match target="font"&gt;
&lt;edit name="rgba" mode="assign"&gt;
&lt;const&gt;rgb&lt;/const&gt;
&lt;/edit&gt;
&lt;/match&gt;
</screen>
The string <quote><literal remap="tt">rgb</literal></quote> within the
<quote><literal remap="tt">&lt;const&gt;</literal></quote>...<quote><literal remap="tt">&lt;/const&gt;</literal></quote>
specifies the order of pixel components on your display, and should be
changed to match your hardware; it can be one of <quote><literal remap="tt">rgb</literal></quote> (normal
LCD screen), <quote><literal remap="tt">bgr</literal></quote> (backwards LCD screen), <quote><literal remap="tt">vrgb</literal></quote> (LCD
screen rotated clockwise) or <quote><literal remap="tt">vbgr</literal></quote> (LCD screen rotated
counterclockwise).
</para>
</sect3>
<sect3 id='Configuring_applications'>
<title>Configuring applications</title>
<para>
A growing number of applications use Xft in preference to the core
fonts system. Some applications, however, need to be explicitly
configured to use Xft.
</para>
<para>
A case in point is XTerm, which can be set to use Xft by using the
<quote><literal remap="tt">-fa</literal></quote> command line option or by setting the <quote><literal remap="tt">XTerm*faceName</literal></quote>
resource:
<screen>
XTerm*faceName: Courier
</screen>
or
<screen>
$ xterm -fa "Courier"
</screen>
</para>
<para>
For KDE applications, you should select <quote>Anti-alias fonts</quote> in the
<quote>Fonts</quote> panel of KDE's <quote>Control Center</quote>. Note that this option is
misnamed: it switches KDE to using Xft but doesn't enable
anti-aliasing in case it was disabled by your Xft configuration file.
</para>
<para>
Gnome applications and Mozilla Firefox will use Xft by default.
</para>
</sect3>
</sect2>
<sect2 id='Configuring_the_core_X11_fonts_system'>
<title>Configuring the core X11 fonts system</title>
<para>
Installing fonts in the core system is a two step process. First,
you need to create a <emphasis remap="it">font directory</emphasis> that contains all the
relevant font files as well as some index files. You then need to
inform the X server of the existence of this new directory by
including it in the <emphasis remap="it">font path</emphasis>.
</para>
<sect3 id='Installing_bitmap_fonts'>
<title>Installing bitmap fonts</title>
<para>
The X11R&relvers; server can use bitmap fonts in both the cross-platform
BDF format and the somewhat more efficient binary PCF format.
(X11R&relvers; also supports the obsolete SNF format.)
</para>
<para>
Bitmap fonts are normally distributed in the BDF format. Before
installing such fonts, it is desirable (but not absolutely necessary)
to convert the font files to the PCF format. This is done by using the
command <quote><command>bdftopcf</command></quote>, <emphasis remap="it">e.g.</emphasis>
<screen>
$ bdftopcf courier12.bdf
</screen>
You may then want to compress the resulting PCF font files:
<screen>
$ gzip courier12.pcf
</screen>
</para>
<para>
After the fonts have been converted, you should copy all the font
files that you wish to make available into a arbitrary directory, say
<quote><filename>/usr/local/share/fonts/bitmap/</filename></quote>. You should then create the
index file <quote><filename>fonts.dir</filename></quote> by running the command <quote><command>mkfontdir</command></quote>
(please see the <ulink
url="mkfontdir.1.html"
>mkfontdir(1)</ulink
>
manual page for more information):
<screen>
$ mkdir /usr/local/share/fonts/bitmap/
$ cp *.pcf.gz /usr/local/share/fonts/bitmap/
$ mkfontdir /usr/local/share/fonts/bitmap/
</screen>
</para>
<para>
All that remains is to tell the X server about the existence of the
new font directory; see <xref linkend='Setting_the_servers_font_path' xrefstyle='select: title'/> below.
</para>
</sect3>
<sect3 id='Installing_scalable_fonts'>
<title>Installing scalable fonts</title>
<para>
The X11R&relvers; server supports scalable fonts in multiple
formats, including Type&nbsp;1, TrueType, and OpenType/CFF.
(Earlier versions of X11 also included support for the Speedo and
CID scalable font formats, but that is not included in current releases.)
</para>
<para>
Installing scalable fonts is very similar to installing bitmap fonts:
you create a directory with the font files, and run <quote><command>mkfontdir</command></quote>
to create an index file called <quote><filename>fonts.dir</filename></quote>.
</para>
<para>
There is, however, a big difference: <quote><command>mkfontdir</command></quote> cannot
automatically recognise scalable font files. For that reason, you
must first index all the font files in a file called
<quote><filename>fonts.scale</filename></quote>. While this can be done by hand, it is best done
by using the <quote><command>mkfontscale</command></quote> utility.
<screen>
$ mkfontscale /usr/local/share/fonts/Type1/
$ mkfontdir /usr/local/share/fonts/Type1/
</screen>
Under some circumstances, it may be necessary to modify the
<quote><filename>fonts.scale</filename></quote> file generated by <command>mkfontscale</command>; for more
information, please see the <ulink
url="mkfontdir.1.html"
>mkfontdir(1)</ulink
> and <ulink
url="mkfontscale.1.html"
>mkfontscale(1)</ulink
> manual pages and <xref linkend='Core_fonts_and_internationalisation' xrefstyle='select: title'/>
later in this document.
</para>
</sect3>
<sect3 id='CID_keyed_fonts'>
<title>CID-keyed fonts</title>
<para>
The CID-keyed font format was designed by Adobe Systems for fonts
with large character sets. The CID-keyed format is obsolete, as it
has been superseded by other formats such as OpenType/CFF and
support for CID-keyed fonts has been removed from X11.
</para>
</sect3>
<sect3 id='Setting_the_servers_font_path'>
<title>Setting the server's font path</title>
<para>
The list of directories where the server looks for fonts is known
as the <emphasis remap="it">font path</emphasis>. Informing the server of the existence of a new
font directory consists of putting it on the font path.
</para>
<para>
The font path is an ordered list; if a client's request matches
multiple fonts, the first one in the font path is the one that gets
used. When matching fonts, the server makes two passes over the font
path: during the first pass, it searches for an exact match; during
the second, it searches for fonts suitable for scaling.
</para>
<para>
For best results, scalable fonts should appear in the font path before
the bitmap fonts; this way, the server will prefer bitmap fonts to
scalable fonts when an exact match is possible, but will avoid scaling
bitmap fonts when a scalable font can be used. (The <quote><literal remap="tt">:unscaled</literal></quote>
hack, while still supported, should no longer be necessary in X11R&relvers;.)
</para>
<para>
You may check the font path of the running server by typing the command
<screen>
$ xset q
</screen>
</para>
<sect4 id='Font_path_catalogue_directories'>
<title>Font path catalogue directories</title>
<para>
You can specify a special kind of font path directory in the form
<filename>catalogue:&lt;dir&gt;</filename>.
The directory specified after the <filename>catalogue:</filename>
prefix will be scanned for symlinks and each symlink destination will be
added as a local font path entry.
</para>
<para>
The symlink can be suffixed by attributes such as
'<literal remap="tt">unscaled</literal>', which will be passed through
to the underlying font path entry. The only exception is the newly
introduced '<literal remap="tt">pri</literal>' attribute, which will be
used for ordering the font paths specified by the symlinks.
</para>
<para>
An example configuration:
<screen>
75dpi:unscaled:pri=20 -&gt; /usr/share/X11/fonts/75dpi
ghostscript:pri=60 -&gt; /usr/share/fonts/default/ghostscript
misc:unscaled:pri=10 -&gt; /usr/share/X11/fonts/misc
type1:pri=40 -&gt; /usr/share/X11/fonts/Type1
type1:pri=50 -&gt; /usr/share/fonts/default/Type1
</screen>
</para>
<para>
This will add <filename>/usr/share/X11/fonts/misc</filename> as the
first font path entry with the attribute
<literal remap="tt">unscaled</literal>. This is functionally equivalent to
setting the following font path:
<screen>
/usr/share/X11/fonts/misc:unscaled,
/usr/share/X11/fonts/75dpi:unscaled,
/usr/share/X11/fonts/Type1,
/usr/share/fonts/default/Type1,
/usr/share/fonts/default/ghostscript
</screen>
</para>
</sect4>
<sect4 id='Temporary_modification_of_the_font_path'>
<title>Temporary modification of the font path</title>
<para>
The <quote><command>xset</command></quote> utility may be used to modify the font path for the
current session. The font path is set with the command <command>xset fp</command>;
a new element is added to the front with <command>xset +fp</command>, and added to
the end with <command>xset fp+</command>. For example,
<screen>
$ xset +fp /usr/local/fonts/Type1
$ xset fp+ /usr/local/fonts/bitmap
</screen>
</para>
<para>
Conversely, an element may be removed from the front of the font path
with <quote><command>xset -fp</command></quote>, and removed from the end with <quote><command>xset fp-</command></quote>.
You may reset the font path to its default value with
<quote><command>xset fp default</command></quote>.
</para>
<para>
For more information, please consult the <ulink
url="xset.1.html"
>xset(1)</ulink
> manual page.
</para>
</sect4>
<sect4 id='Permanent_modification_of_the_font_path'>
<title>Permanent modification of the font path</title>
<para>
The default font path (the one used just after server startup or
after <quote><command>xset fp default</command></quote>) may be specified in the
X server's
<quote><filename>xorg.conf</filename></quote> file. It is computed by appending all the
directories mentioned in the <quote><literal remap="tt">FontPath</literal></quote> entries of the
<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
value specified when it was built.
<screen>
FontPath "/usr/local/fonts/Type1"
...
FontPath "/usr/local/fonts/bitmap"
</screen>
</para>
<para>
For more information, please consult the <ulink
url="xorg.conf.5.html"
>xorg.conf(5)</ulink
> manual page.
</para>
</sect4>
</sect3>
<sect3 id='Troubleshooting'>
<title>Troubleshooting</title>
<para>
If you seem to be unable to use some of the fonts you have
installed, the first thing to check is that the <quote><filename>fonts.dir</filename></quote> files
are correct and that they are readable by the server (the X server
usually runs as root, beware of NFS-mounted font directories). If
this doesn't help, it is quite possible that you are trying to use a
font in a format that is not supported by your server.
</para>
<para>
X11R&relvers; supports the BDF, PCF, SNF, Type 1, TrueType, and OpenType
font formats. However, not all X11R&relvers; servers
come with all the font backends configured in.
</para>
<para>
On most platforms, the X11R&relvers; servers no longer uses font
backends from modules that are loaded at runtime. The built in
font support corresponds to the functionality formerly provided by
these modules:
<itemizedlist>
<listitem>
<para>
<literal remap="tt">"bitmap"</literal>:
bitmap fonts (<quote><filename>*.bdf</filename></quote>,
<quote><filename>*.pcf</filename></quote>
and <quote><filename>*.snf</filename></quote>);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">"freetype"</literal>:
TrueType fonts (<quote><filename>*.ttf</filename></quote> and
<quote><filename>*.ttc</filename></quote>),
OpenType fonts (<quote><filename>*.otf</filename></quote> and
<quote><filename>*.otc</filename></quote>) and
Type&nbsp;1 fonts (<quote><filename>*.pfa</filename></quote>
and <quote><filename>*.pfb</filename></quote>).
</para>
</listitem>
</itemizedlist>
</para>
</sect3>
</sect2>
</sect1>
<sect1 id='Fonts_included_with_X11'>
<title>Fonts included with X11R&relvers;</title>
<sect2 id='Standard_bitmap_fonts'>
<title>Standard bitmap fonts</title>
<para>
The Sample Implementation of X11 (SI) comes with a large number of
bitmap fonts, including the <quote><literal remap="tt">fixed</literal></quote> family, and bitmap versions
of Courier, Times, Helvetica and some members of the Lucida family.
</para>
<para>
In X11R&relvers;, a number of these fonts are provided in Unicode-encoded
font files now. At build time, these fonts are split into font
files encoded according to legacy encodings, a process which allows
us to provide the standard fonts in a number of regional encodings
with no duplication of work.
</para>
<para>
For example, the font file
<screen>
/usr/share/fonts/X11/misc/6x13.bdf
</screen>
with XLFD
<screen>
-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1
</screen>
is a Unicode-encoded version of the standard <quote><literal remap="tt">fixed</literal></quote> font with
added support for the Latin, Greek, Cyrillic, Georgian, Armenian, IPA
and other scripts plus numerous technical symbols. It contains over
2800 glyphs, covering all characters of ISO&nbsp;8859 parts 1-5,
7-10, 13-15, as well as all European IBM and Microsoft code pages,
KOI8, WGL4, and the repertoires of many other character sets.
</para>
<para>
This font is used at build time for generating the font files
<screen>
6x13-ISO8859-1.bdf
6x13-ISO8859-2.bdf
...
6x13-ISO8859-15.bdf
6x13-KOI8-R.bdf
</screen>
with respective XLFDs
<screen>
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
...
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-15
-misc-fixed-medium-r-normal--13-120-75-75-c-60-koi8-r
</screen>
The standard short name <quote><literal remap="tt">fixed</literal></quote> is normally an alias for
<screen>
-misc-fixed-medium-r-normal--13-120-75-75-c-60-iso8859-1
</screen>
</para>
</sect2>
<sect2 id='The_ClearlyU_Unicode_font_family'>
<title>The ClearlyU Unicode font family</title>
<para>
The ClearlyU family of fonts provides a set of 12&nbsp;pt,
100&nbsp;dpi proportional fonts with many of the glyphs needed for
Unicode text. Together, the fonts contain approximately 7500 glyphs.
</para>
<para>
The main ClearlyU font has the XLFD
<screen>
-mutt-clearlyu-medium-r-normal--17-120-100-100-p-101-iso10646-1
</screen>
and resides in the font file
<screen>
/usr/share/fonts/X11/misc/cu12.pcf.gz
</screen>
Additional ClearlyU fonts include
<screen>
-mutt-clearlyu alternate glyphs-medium-r-normal--17-120-100-100-p-91-iso10646-1
-mutt-clearlyu pua-medium-r-normal--17-120-100-100-p-111-iso10646-1
-mutt-clearlyu arabic extra-medium-r-normal--17-120-100-100-p-103-fontspecific-0
-mutt-clearlyu ligature-medium-r-normal--17-120-100-100-p-141-fontspecific-0
</screen>
</para>
<para>
The <emphasis remap="it">Alternate Glyphs</emphasis> font contains additional glyph shapes that
are needed for certain languages. A second alternate glyph font will
be provided later for cases where a character has more than one
commonly used alternate shape (<emphasis remap="it">e.g.</emphasis> the Urdu heh).
</para>
<para>
The <emphasis remap="it">PUA</emphasis> font contains extra glyphs that are useful for certain
rendering purposes.
</para>
<para>
The <emphasis remap="it">Arabic Extra</emphasis> font contains the glyphs necessary for
characters that don't have all of their possible shapes encoded in
ISO&nbsp;10646. The glyphs are roughly ordered according to the order
of the characters in the ISO&nbsp;10646 standard.
</para>
<para>
The <emphasis remap="it">Ligature</emphasis> font contains ligatures for various scripts that
may be useful for improved presentation of text.
</para>
</sect2>
<sect2 id='Standard_scalable_fonts'>
<title>Standard scalable fonts</title>
<para>
X11R&relvers; includes all the scalable fonts distributed with X11R6.
</para>
<sect3 id='Standard_Type1_fonts'>
<title>Standard Type&nbsp;1 fonts</title>
<para>
The IBM Courier set of fonts cover ISO&nbsp;8859-1 and
ISO&nbsp;8859-2 as well as Adobe Standard Encoding. These fonts have
XLFD
<screen>
-adobe-courier-medium-*-*--0-0-0-0-m-0-*-*
</screen>
and reside in the font files
<screen>
/usr/share/fonts/X11/Type1/cour*.pfa
</screen>
</para>
<para>
The Adobe Utopia set of fonts only cover ISO&nbsp;8859-1 as well as
Adobe Standard Encoding. These fonts have XLFD
<screen>
-adobe-utopia-*-*-normal--0-0-0-0-p-0-iso8859-1
</screen>
and reside in the font files
<screen>
/usr/share/fonts/X11/Type1/UT*.pfa
</screen>
</para>
<para>
Finally, X11R&relvers; also comes with Type&nbsp;1 versions of Bitstream
Courier and Charter. These fonts have XLFD
<screen>
-bitstream-courier-*-*-normal--0-0-0-0-m-0-iso8859-1
-bitstream-charter-*-*-normal--0-0-0-0-p-0-iso8859-1
</screen>
and reside in the font files
<screen>
/usr/share/fonts/X11/Type1/c*bt_.pfb
</screen>
</para>
</sect3>
</sect2>
<sect2 id='The_Bigelow_and__Holmes_Luxi_family'>
<title>The Bigelow &amp; Holmes Luxi family</title>
<para>
X11R&relvers; includes the <emphasis remap="it">Luxi</emphasis> family of scalable fonts, in both
TrueType and Type&nbsp;1 format. This family consists of the fonts
<emphasis remap="it">Luxi Serif</emphasis>, with XLFD
<screen>
-b&amp;h-luxi serif-medium-*-normal--*-*-*-*-p-*-*-*
</screen>
<emphasis remap="it">Luxi Sans</emphasis>, with XLFD
<screen>
-b&amp;h-luxi sans-medium-*-normal--*-*-*-*-p-*-*-*
</screen>
and <emphasis remap="it">Luxi Mono</emphasis>, with XLFD
<screen>
-b&amp;h-luxi mono-medium-*-normal--*-*-*-*-m-*-*-*
</screen>
Each of these fonts comes Roman, oblique, bold and bold oblique variants
The TrueType version have glyphs covering the basic ASCII Unicode
range, the Latin&nbsp;1 range, as well as the <emphasis remap="it">Extended Latin</emphasis>
range and some additional punctuation characters. In particular,
these fonts include all the glyphs needed for ISO&nbsp;8859 parts 1,
2, 3, 4, 9, 13 and 15, as well as all the glyphs in the Adobe Standard
encoding and the Windows 3.1 character set.
</para>
<para>
The glyph coverage of the Type&nbsp;1 versions is somewhat reduced,
and only covers ISO&nbsp;8859 parts 1, 2 and 15 as well as the Adobe
Standard encoding.
</para>
<para>
The Luxi fonts are original designs by Kris Holmes and Charles
Bigelow. Luxi fonts include seriffed, sans serif, and monospaced
styles, in roman and oblique, and normal and bold weights. The fonts
share stem weight, x-height, capital height, ascent and descent, for
graphical harmony.
</para>
<para>
The character width metrics of Luxi roman and bold fonts match those
of core fonts bundled with popular operating and window systems.
</para>
<para>
The license terms for the Luxi fonts are included in the file
<quote><filename>COPYRIGHT.BH</filename></quote>, as well as in the <olink
targetdoc='License'
targetptr='Bigelow_Holmes_Inc_and_URW_GmbH_Luxi_font_license'>License
document</olink>.
</para>
<para>
Charles Bigelow and Kris Holmes from Bigelow and Holmes Inc.
developed the Luxi typeface designs in Ikarus digital format.
</para>
<para>
URW++ Design and Development GmbH converted the Ikarus format fonts
to TrueType and Type1 font programs and implemented the grid-fitting
"hints" and kerning tables in the Luxi fonts.
</para>
<para>
For more information, please contact
<email>design@bigelowandholmes.com</email> or
<email>info@urwpp.de</email>, or consult
<ulink url="http://www.urwpp.de">the URW++ web site</ulink>.
</para>
<para>
An earlier version of the Luxi fonts was made available under the
name <emphasis>Lucidux</emphasis>. This name should no longer be used due to
trademark uncertainties, and all traces of the <emphasis>Lucidux</emphasis>
name have been removed from X11R&relvers;.
</para>
</sect2>
</sect1>
<sect1 id='More_about_core_fonts'>
<title>More about core fonts</title>
<para>
This section describes XFree86-created enhancements to the core
X11 fonts system that were adopted by X.Org.
</para>
<sect2 id='Core_fonts_and_internationalisation'>
<title>Core fonts and internationalisation</title>
<para>
The scalable font backends (Type&nbsp;1 and TrueType) can
automatically re-encode fonts to the encoding specified in the
XLFD in <quote><filename>fonts.dir</filename></quote>. For example, a <quote><filename>fonts.dir</filename></quote> file can
contain entries for the Type&nbsp;1 Courier font such as
<screen>
cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
cour.pfa -adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-2
</screen>
which will lead to the font being recoded to ISO&nbsp;8859-1 and
ISO&nbsp;8859-2 respectively.
</para>
<sect3 id='The_fontenc_layer'>
<title>The <emphasis remap="it">fontenc</emphasis> layer</title>
<para>
Two of the scalable backends (Type&nbsp;1 and the
<emphasis remap="it">FreeType</emphasis> TrueType backend) use a common <emphasis remap="it">fontenc</emphasis> layer for
font re-encoding. This allows these backends to share their encoding
data, and allows simple configuration of new locales independently of
font type.
</para>
<para>
<emphasis remap="it">Please note:</emphasis> the X-TrueType (X-TT) backend is not included
in X11R&relvers;. That functionality has been merged into the FreeType
backend.
</para>
<para>
In the <emphasis remap="it">fontenc</emphasis> layer, an encoding is defined by a name (such as
<literal remap="tt">iso8859-1</literal>), possibly a number of aliases (alternate names), and
an ordered collection of mappings. A mapping defines the way the
encoding can be mapped into one of the <emphasis remap="it">target encodings</emphasis> known to
<emphasis remap="it">fontenc</emphasis>; currently, these consist of Unicode, Adobe glyph names,
and arbitrary TrueType <quote>cmap</quote>s.
</para>
<para>
A number of encodings are hardwired into <emphasis remap="it">fontenc</emphasis>, and are
therefore always available; the hardcoded encodings cannot easily be
redefined. These include:
<itemizedlist>
<listitem>
<para>
<literal remap="tt">iso10646-1</literal>: Unicode;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-1</literal>: ISO&nbsp;Latin-1 (Western Europe);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-2</literal>: ISO&nbsp;Latin-2 (Eastern Europe);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-3</literal>: ISO&nbsp;Latin-3 (Southern Europe);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-4</literal>: ISO&nbsp;Latin-4 (Northern Europe);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-5</literal>: ISO&nbsp;Cyrillic;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-6</literal>: ISO&nbsp;Arabic;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-7</literal>: ISO&nbsp;Greek;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-8</literal>: ISO&nbsp;Hebrew;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-9</literal>: ISO&nbsp;Latin-5 (Turkish);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-10</literal>: ISO&nbsp;Latin-6 (Nordic);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">iso8859-15</literal>: ISO&nbsp;Latin-9, or Latin-0 (Revised
Western-European);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">koi8-r</literal>: KOI8 Russian;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">koi8-u</literal>: KOI8 Ukrainian (see RFC 2319);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">koi8-ru</literal>: KOI8 Russian/Ukrainian;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">koi8-uni</literal>: KOI8 <quote>Unified</quote> (Russian, Ukrainian, and
Byelorussian);
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">koi8-e</literal>: KOI8 <quote>European,</quote> ISO-IR-111, or ECMA-Cyrillic;
</para>
</listitem>
<listitem>
<para>
<literal remap="tt">microsoft-symbol</literal> and <literal remap="tt">apple-roman</literal>: these are only
likely to be useful with TrueType symbol fonts.
</para>
</listitem>
</itemizedlist>
</para>
<para>
Additional encodings can be added by defining <emphasis remap="it">encoding files</emphasis>.
When a font encoding is requested that the <emphasis remap="it">fontenc</emphasis> layer doesn't
know about, the backend checks the directory in which the font file
resides (not necessarily the directory with <filename>fonts.dir</filename>!) for a
file named <quote><filename>encodings.dir</filename></quote>. If found, this file is scanned for
the requested encoding, and the relevant encoding definition file is
read in. The <quote><command>mkfontdir</command></quote> utility, when invoked with the
<quote><literal remap="tt">-e</literal></quote> option followed by the name of a directory containing
encoding files, can be used to automatically build <quote><filename>encodings.dir</filename></quote>
files. Please see the <ulink
url="mkfontdir.1.html"
>mkfontdir(1)</ulink
>
manual page for more details.
</para>
<para>
A number of encoding files for common encodings are included with
X11R&relvers;. Information on writing new encoding files can be found in
<xref linkend='Format_of_encoding_directory_files' xrefstyle='select: title'/>
and <xref linkend='Format_of_encoding_files' xrefstyle='select: title'/> later in this document.
</para>
</sect3>
<sect3 id='Backend-specific_notes_about_fontenc'>
<title>Backend-specific notes about fontenc</title>
<sect4 id='The_FreeType_backend'>
<title>The <emphasis remap="it">FreeType</emphasis> backend</title>
<para>
For TrueType and OpenType fonts, the FreeType backend scans the
mappings in order. Mappings with a target of PostScript are ignored;
mappings with a TrueType or Unicode target are checked against all the
cmaps in the file. The first applicable mapping is used.
</para>
<para>
For Type&nbsp;1 fonts, the FreeType backend first searches for a
mapping with a target of PostScript. If one is found, it is used.
Otherwise, the backend searches for a mapping with target Unicode,
which is then composed with a built-in table mapping codes to glyph
names. Note that this table only covers part of the Unicode code
points that have been assigned names by Adobe.
</para>
<para>
Specifying an encoding value of <literal remap="tt">adobe-fontspecific</literal> for a
Type&nbsp;1 font disables the encoding mechanism. This is useful with
symbol and incorrectly encoded fonts (see
<xref linkend='Hints_about_using_badly_encoded_fonts' xrefstyle='select: title'/> below).
</para>
<para>
If a suitable mapping is not found, the FreeType backend defaults to
ISO&nbsp;8859-1.
</para>
</sect4>
</sect3>
<sect3 id='Format_of_encoding_directory_files'>
<title>Format of encoding directory files</title>
<para>
In order to use a font in an encoding that the font backend does
not know about, you need to have an <quote><filename>encodings.dir</filename></quote> file either
in the same directory as the font file used or in a system-wide
location (<quote><filename>/usr/share/fonts/X11/encodings/</filename></quote> by default).
</para>
<para>
The <quote><filename>encodings.dir</filename></quote> file has a similar format to
<quote><filename>fonts.dir</filename></quote>. Its first line specifies the number of encodings,
while every successive line has two columns, the name of the encoding,
and the name of the encoding file; this can be relative to the current
directory, or absolute. Every encoding name should agree with the
encoding name defined in the encoding file. For example,
</para>
<para>
<screen>
3
mulearabic-0 /usr/share/fonts/X11/encodings/mulearabic-0.enc
mulearabic-1 /usr/share/fonts/X11/encodings/mulearabic-1.enc
mulearabic-2 /usr/share/fonts/X11/encodings/mulearabic-2.enc
</screen>
</para>
<para>
The name of an encoding <emphasis remap="it">must</emphasis> be specified in the encoding file's
<quote><literal remap="tt">STARTENCODING</literal></quote> or <quote><literal remap="tt">ALIAS</literal></quote> line. It is not enough to create
an <quote><filename>encodings.dir</filename></quote> entry.
</para>
<para>
If your platform supports it (it probably does), encoding files may be
compressed or gzipped.
</para>
<para>
The <quote><filename>encoding.dir</filename></quote> files are best maintained by the
<quote><command>mkfontdir</command></quote> utility. Please see the <ulink
url="mkfontdir.1.html"
>mkfontdir(1)</ulink
> manual page for more information.
</para>
</sect3>
<sect3 id='Format_of_encoding_files'>
<title>Format of encoding files</title>
<para>
The encoding files are <quote>free form,</quote> <emphasis remap="it">i.e.</emphasis> any string of
whitespace is equivalent to a single space. Keywords are parsed in a
non-case-sensitive manner, meaning that <quote><literal remap="tt">size</literal></quote>, <quote><literal remap="tt">SIZE</literal></quote>, and
<quote><literal remap="tt">SiZE</literal></quote> all parse as the same keyword; on the other hand, case is
significant in glyph names.
</para>
<para>
Numbers can be written in decimal, as in <quote><literal remap="tt">256</literal></quote>, in hexadecimal,
as in <quote><literal remap="tt">0x100</literal></quote>, or in octal, as in <quote><literal remap="tt">0400</literal></quote>.
</para>
<para>
Comments are introduced by a hash sign <quote><literal remap="tt">&num;</literal></quote>. A <quote><literal remap="tt">&num;</literal></quote> may
appear at any point in a line, and all characters following the
<quote><literal remap="tt">&num;</literal></quote> are ignored, up to the end of the line.
</para>
<para>
The encoding file starts with the definition of the name of the
encoding, and possibly its alternate names (aliases):
<screen>
STARTENCODING mulearabic-0
ALIAS arabic-0
</screen>
The name of the encoding and its aliases should be suitable for use in
an XLFD font name, and therefore contain exactly one dash <quote><literal remap="tt">-</literal></quote>.
</para>
<para>
The encoding file may then optionally declare the size of the
encoding. For a linear encoding (such as ISO&nbsp;8859-1), the SIZE
line specifies the maximum code plus one:
<screen>
SIZE 0x2B
</screen>
For a matrix encoding, it should specify two numbers. The first is
the number of the last row plus one, the other, the highest column
number plus one. In the case of <quote><literal remap="tt">jisx0208.1990-0</literal></quote>
(JIS&nbsp;X&nbsp;0208(1990), double-byte encoding, high bit clear), it
should be
<screen>
SIZE 0x75 0x80
</screen>
In the case of a matrix encoding, a <quote><literal remap="tt">FIRSTINDEX</literal></quote> line may be
included to specify the minimum glyph index in an encoding. The
keyword <quote><literal remap="tt">FIRSTINDEX</literal></quote> is followed by two integers, the minimum row
number followed by the minimum column number:
<screen>
FIRSTINDEX 0x20 0x20
</screen>
In the case of a linear encoding, a <quote><literal remap="tt">FIRSTINDEX</literal></quote> line is not very
useful. If for some reason however you chose to include on, it should
be followed by a single integer.
</para>
<para>
Note that in most font backends inclusion of a <quote><literal remap="tt">FIRSTINDEX</literal></quote> line
has the side effect of disabling default glyph generation, and this
keyword should therefore be avoided unless absolutely necessary.
</para>
<para>
Codes outside the region defined by the <quote><literal remap="tt">SIZE</literal></quote> and
<quote><literal remap="tt">FIRSTINDEX</literal></quote> lines are understood to be undefined. Encodings
default to linear encoding with a size of 256 (0x100). This means
that you must declare the size of all 16 bit encodings.
</para>
<para>
What follows is one or more mapping sections. A mapping section
starts with a <quote><literal remap="tt">STARTMAPPING</literal></quote> line stating the target of the mapping.
The target may be one of:
<itemizedlist>
<listitem>
<para>
Unicode (ISO&nbsp;10646):
<screen>
STARTMAPPING unicode
</screen>
</para>
</listitem>
<listitem>
<para>
a given TrueType <quote>cmap</quote>:
<screen>
STARTMAPPING cmap 3 1
</screen>
</para>
</listitem>
<listitem>
<para>
PostScript glyph names:
<screen>
STARTMAPPING postscript
</screen>
</para>
</listitem>
</itemizedlist>
Every line in a mapping section maps one from the encoding being
defined to the target of the mapping. In mappings with a Unicode or
TrueType mapping, codes are mapped to codes:
<screen>
0x21 0x0660
0x22 0x0661
...
</screen>
As an abbreviation, it is possible to map a contiguous range of codes
in a single line. A line consisting of three integers
<screen>
&#60;it/start/ &#60;it/end/ &#60;it/target/
</screen>
is an abbreviation for the range of lines
<screen>
<emphasis remap="it">start</emphasis> <emphasis remap="it">target</emphasis>
</screen>
<screen>
<emphasis remap="it">start</emphasis>+1 <emphasis remap="it">target</emphasis>+1
</screen>
<screen>
...
</screen>
<screen>
<emphasis remap="it">end</emphasis> <emphasis remap="it">target</emphasis>+<emphasis remap="it">end</emphasis>-<emphasis remap="it">start</emphasis>
</screen>
For example, the line
<screen>
0x2121 0x215F 0x8140
</screen>
is an abbreviation for
<screen>
0x2121 0x8140
0x2122 0x8141
...
0x215F 0x817E
</screen>
Codes not listed are assumed to map through the identity (<emphasis remap="it">i.e.</emphasis> to
the same numerical value). In order to override this default mapping,
you may specify a range of codes to be undefined by using an
<quote><literal remap="tt">UNDEFINE</literal></quote> line:
<screen>
UNDEFINE 0x00 0x2A
</screen>
or, for a single code,
<screen>
UNDEFINE 0x1234
</screen>
</para>
<para>
PostScript mappings are different. Every line in a PostScript mapping
maps a code to a glyph name
<screen>
0x41 A
0x42 B
...
</screen>
and codes not explicitly listed are undefined.
</para>
<para>
A mapping section ends with an <literal remap="tt">ENDMAPPING</literal> line
<screen>
ENDMAPPING
</screen>
After all the mappings have been defined, the file ends with an
<literal remap="tt">ENDENCODING</literal> line
<screen>
ENDENCODING
</screen>
</para>
<para>
In order to make future extensions to the format possible, lines
starting with an unknown keyword are silently ignored, as are mapping
sections with an unknown target.
</para>
</sect3>
<sect3 id='Using_symbol_fonts'>
<title>Using symbol fonts</title>
<para>
Type&nbsp;1 symbol fonts should be installed using the
<literal remap="tt">adobe-fontspecific</literal> encoding.
</para>
<para>
In an ideal world, all TrueType symbol fonts would be installed using
one of the <literal remap="tt">microsoft-symbol</literal> and <literal remap="tt">apple-roman</literal> encodings. A
number of symbol fonts, however, are not marked as such; such fonts
should be installed using <literal remap="tt">microsoft-cp1252</literal>, or, for older fonts,
<literal remap="tt">microsoft-win3.1</literal>.
</para>
<para>
In order to guarantee consistent results (especially between
Type&nbsp;1 and TrueType versions of the same font), it is possible to
define a special encoding for a given font. This has already been done
for the <literal remap="tt">ZapfDingbats</literal> font; see the file
<quote><filename>encodings/adobe-dingbats.enc</filename></quote>.
</para>
</sect3>
<sect3 id='Hints_about_using_badly_encoded_fonts'>
<title>Hints about using badly encoded fonts</title>
<para>
A number of text fonts are incorrectly encoded. Incorrect encoding
is sometimes done by design, in order to make a font for an exotic
script appear like an ordinary Western text font on systems which are
not easily extended with new locale data. It is often the result of
the font designer's laziness or incompetence; for some reason, most
people seem to find it easier to invent idiosyncratic glyph names
rather than follow the Adobe glyph list.
</para>
<para>
There are two ways of dealing with such fonts: using them with the
encoding they were designed for, and creating an <emphasis remap="it">ad hoc</emphasis> encoding
file.
</para>
<sect4 id='Using_fonts_with_the_designers_encoding'>
<title>Using fonts with the designer's encoding</title>
<para>
In the case of Type&nbsp;1 fonts, the font designer can specify a
default encoding; this encoding is requested by using the
<quote><literal remap="tt">adobe-fontspecific</literal></quote> encoding in the XLFD name. Sometimes, the
font designer omitted to specify a reasonable default encoding, in
which case you should experiment with <quote><literal remap="tt">adobe-standard</literal></quote>,
<quote><literal remap="tt">iso8859-1</literal></quote>, <quote><literal remap="tt">microsoft-cp1252</literal></quote>, and
<quote><literal remap="tt">microsoft-win3.1</literal></quote>. (The encoding <quote><literal remap="tt">microsoft-symbol</literal></quote> doesn't
make sense for Type&nbsp;1 fonts).
</para>
<para>
TrueType fonts do not have a default encoding. However, most TrueType
fonts are designed with either Microsoft or Apple platforms in mind,
so one of <quote><literal remap="tt">microsoft-symbol</literal></quote>, <quote><literal remap="tt">microsoft-cp1252</literal></quote>,
<quote><literal remap="tt">microsoft-win3.1</literal></quote>, or <quote><literal remap="tt">apple-roman</literal></quote> should yield reasonable
results.
</para>
</sect4>
<sect4 id='Specifying_an_ad_hoc_encoding_file'>
<title>Specifying an <emphasis remap="it">ad hoc</emphasis> encoding file</title>
<para>
It is always possible to define an encoding file to put the glyphs
in a font in any desired order. Again, see the
<quote><filename>encodings/adobe-dingbats.enc</filename></quote> file to see how this is done.
</para>
</sect4>
<sect4 id='Specifying_font_aliases'>
<title>Specifying font aliases</title>
<para>
By following the directions above, you will find yourself with a
number of fonts with unusual names --- with encodings such as
<quote><literal remap="tt">adobe-fontspecific</literal></quote>, <quote><literal remap="tt">microsoft-win3.1</literal></quote> <emphasis remap="it">etc</emphasis>. In order
to use these fonts with standard applications, it may be useful to
remap them to their proper names.
</para>
<para>
This is done by writing a <quote><filename>fonts.alias</filename></quote> file. The format of this file
is very simple: it consists of a series of lines each mapping an alias
name to a font name. A <quote><filename>fonts.alias</filename></quote> file might look as follows:
<screen>
"-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-iso8859-2" \
"-ogonki-alamakota-medium-r-normal--0-0-0-0-p-0-adobe-fontspecific"
</screen>
(both XLFD names on a single line). The syntax of the
<quote><filename>fonts.alias</filename></quote> file is more precisely described in the
<ulink
url="mkfontdir.1.html"
>mkfontdir(1)</ulink
> manual page.
</para>
</sect4>
</sect3>
</sect2>
<sect2 id='Additional_notes_about_scalable_core_fonts'>
<title>Additional notes about scalable core fonts</title>
<sect3 id='About_the_FreeType_backend'>
<title>About the <emphasis remap="it">FreeType</emphasis> backend</title>
<para>
The <emphasis remap="it">FreeType</emphasis> backend (formerly <emphasis remap="it">xfsft</emphasis>)
is a backend based on version 2 of the FreeType library (see <ulink
url="http://www.freetype.org/"
>the FreeType web site</ulink
>) and has
the X-TT functionalities for CJKV support provided by the After X-TT
Project (see <ulink
url="http://x-tt.sourceforge.jp/"
>the After X-TT Project web site</ulink
>). The <emphasis remap="it">FreeType</emphasis> backend has support for the
<quote>fontenc</quote> style of internationalisation (see
<xref linkend='The_fontenc_layer' xrefstyle='select: title'/>). This backend supports TrueType font files
(<quote><filename>*.ttf</filename></quote>), OpenType font files (<quote><filename>*.otf</filename></quote>), TrueType Collections
(<quote><filename>*.ttc</filename></quote>), OpenType Collections (<quote><filename>*.otc</filename></quote>) and Type 1 font
files (<quote><filename>*.pfa</filename></quote> and <quote><filename>*.pfb</filename></quote>).
</para>
<para>
In order to access the faces in a TrueType Collection file, the face
number must be specified in the fonts.dir file before the filename,
within a pair of colons, or by setting the 'fn' TTCap option. For example,
</para>
<para>
<screen>
:1:mincho.ttc -misc-pmincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
</screen>
</para>
<para>
refers to face 1 in the <quote><filename>mincho.ttc</filename></quote> TrueType Collection file.
</para>
<para>
The new <emphasis remap="it">FreeType</emphasis> backend supports the extended
<quote><filename>fonts.dir</filename></quote> syntax introduced by X-TrueType with a number
of options, collectively known as <quote>TTCap</quote>. A <quote>TTCap</quote> entry follows the
general syntax
</para>
<para>
<screen>
option=value:
</screen>
</para>
<para>
and should be specified before the filename. The new <emphasis remap="it">FreeType</emphasis>
almost perfectly supports TTCap options that are compatible with X-TT
1.4. The Automatic Italic (<quote><literal remap="tt">ai</literal></quote>), Double Strike (<quote><literal remap="tt">ds</literal></quote>) and
Bounding box Width (<quote><literal remap="tt">bw</literal></quote>) options are indispensable in CJKV.
For example,
</para>
<para>
<screen>
mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0208.1990-0
ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0208.1990-0
ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0208.1990-0
bw=0.5:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0201.1976-0
bw=0.5:ds=y:mincho.ttc -misc-mincho-bold-r-normal--0-0-0-0-c-0-jisx0201.1976-0
bw=0.5:ai=0.2:mincho.ttc -misc-mincho-medium-i-normal--0-0-0-0-c-0-jisx0201.1976-0
bw=0.5:ds=y:ai=0.2:mincho.ttc -misc-mincho-bold-i-normal--0-0-0-0-c-0-jisx0201.1976-0
</screen>
</para>
<para>
setup the complete combination of jisx0208 and jisx0201 using mincho.ttc
only. More information on the TTCap syntax is found on <ulink
url="http://x-tt.sourceforge.jp/"
>the After X-TT Project page</ulink
>.
</para>
<para>
The <emphasis remap="it">FreeType</emphasis> backend uses the <emphasis remap="it">fontenc</emphasis> layer in order to support
recoding of fonts; this was described in <xref linkend='The_fontenc_layer' xrefstyle='select: title'/>
and especially <xref linkend='The_FreeType_backend' xrefstyle='select: title'/> earlier in this document.
</para>
</sect3>
<sect3 id='Delayed_glyph_rasterisation'>
<title>Delayed glyph rasterisation</title>
<para>
When loading a proportional fonts which contain a huge number of glyphs,
the old <emphasis remap="it">FreeType</emphasis> delayed glyph rasterisation until the time at which
the glyph was first used. The new FreeType (libfreetype-xtt2) has an
improved <quote>very lazy</quote> metric calculation method to speed up the process when
loading TrueType or OpenType fonts. Although the <emphasis remap="it">X-TT</emphasis> module also
has this method, the "<literal remap="tt">vl=y</literal>" TTCap option must be set if you want to
use it. This is the default method for <emphasis remap="it">FreeType</emphasis> when it loads
multi-byte fonts. Even if you use a unicode font which has tens of
thousands of glyphs, this delay will not be worrisome as long as you use
the new <emphasis remap="it">FreeType</emphasis> backend -- its <quote>very lazy</quote> method is super-fast.
</para>
<para>
The maximum error of bitmap position using <quote>very lazy</quote> method is 1 pixel,
and is the same as that of a character-cell spacing. When the X-TT
backend is used with the <quote><literal remap="tt">vl=y</literal></quote> option, a chipped bitmap is displayed
with certain fonts. However, the new FreeType backend has minimal problem
with this, since it corrects left- and right-side bearings using
<quote>italicAngle</quote> in the TrueType/OpenType post table, and does automatic
correction of bitmap positions when rasterisation so that chipped bitmaps
are not displayed. Nevertheless if you don't want to use the <quote>very lazy</quote>
method when using multi-bytes fonts, set <quote><literal remap="tt">vl=n</literal></quote> in the TTCap option to
disable it:
</para>
<para>
<screen>
vl=n:luxirr.ttf -b&amp;h-Luxi Serif-medium-r-normal--0-0-0-0-p-0-iso10646-1
</screen>
</para>
<para>
Of course, both backends also support an optimisation for character-cell
fonts (fonts with all glyph metrics equal, or terminal fonts). A font
with an XLFD specifying a character-cell spacing <quote><literal remap="tt">c</literal></quote>, as in
</para>
<para>
<screen>
-misc-mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
</screen>
</para>
<para>
or
</para>
<para>
<screen>
fs=c:mincho.ttc -misc-mincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
</screen>
</para>
<para>
will not compute the metric for each glyph, but instead
trust the font to be a character-cell font. You are
encouraged to make use of this optimisation when useful, but be warned
that not all monospaced fonts are character-cell fonts.
</para>
</sect3>
</sect2>
</sect1>
<sect1 id='Appendix_background_and_terminology'>
<title>Appendix: background and terminology</title>
<sect2 id='Characters_and_glyphs'>
<title>Characters and glyphs</title>
<para>
A computer text-processing system inputs keystrokes and outputs
<emphasis remap="it">glyphs</emphasis>, small pictures that are assembled on paper or on a
computer screen. Keystrokes and glyphs do not, in general, coincide:
for example, if the system does generate ligatures, then to the
sequence of two keystrokes &lt;<literal remap="tt">f</literal>&gt;&lt;<literal remap="tt">i</literal>&gt; will typically
correspond a single glyph. Similarly, if the system shapes Arabic
glyphs in a vaguely reasonable manner, then multiple different glyphs
may correspond to a single keystroke.
</para>
<para>
The complex transformation rules from keystrokes to glyphs are usually
factored into two simpler transformations, from keystrokes to
<emphasis remap="it">characters</emphasis> and from characters to glyphs. You may want to think
of characters as the basic unit of text that is stored <emphasis remap="it">e.g.</emphasis> in
the buffer of your text editor. While the definition of a character
is intrinsically application-specific, a number of standardised
collections of characters have been defined.
</para>
<para>
A <emphasis remap="it">coded character set</emphasis> is a set of characters together with a
mapping from integer codes --- known as <emphasis remap="it">codepoints</emphasis> --- to
characters. Examples of coded character sets include US-ASCII,
ISO&nbsp;8859-1, KOI8-R, and JIS&nbsp;X&nbsp;0208(1990).
</para>
<para>
A coded character set need not use 8 bit integers to index characters.
Many early systems used 6 bit character sets, while 16 bit (or more)
character sets are necessary for ideographic writing systems.
</para>
</sect2>
<sect2 id='Font_files_fonts_and_XLFD'>
<title>Font files, fonts, and XLFD</title>
<para>
Traditionally, typographers speak about <emphasis remap="it">typefaces</emphasis> and
<emphasis remap="it">founts</emphasis>. A typeface is a particular style or design, such as
Times Italic, while a fount is a molten-lead incarnation of a given
typeface at a given size.
</para>
<para>
Digital fonts come in <emphasis remap="it">font files</emphasis>. A font file contains the
information necessary for generating glyphs of a given typeface, and
applications using font files may access glyph information in an
arbitrary order.
</para>
<para>
Digital fonts may consist of bitmap data, in which case they are said
to be <emphasis remap="it">bitmap fonts</emphasis>. They may also consist of a mathematical
description of glyph shapes, in which case they are said to be
<emphasis remap="it">scalable fonts</emphasis>. Common formats for scalable font files are
<emphasis remap="it">Type&nbsp;1</emphasis> (sometimes incorrectly called <emphasis remap="it">ATM fonts</emphasis> or
<emphasis remap="it">PostScript fonts</emphasis>), <emphasis remap="it">TrueType</emphasis> and <emphasis remap="it">OpenType</emphasis>.
</para>
<para>
The glyph data in a digital font needs to be indexed somehow. How
this is done depends on the font file format. In the case of
Type&nbsp;1 fonts, glyphs are identified by <emphasis remap="it">glyph names</emphasis>. In the
case of TrueType fonts, glyphs are indexed by integers corresponding
to one of a number of indexing schemes (usually Unicode --- see below).
</para>
<para>
The X11 core fonts system uses the data in a font file to generate
<emphasis remap="it">font instances</emphasis>, which are collections of glyphs at a given size
indexed according to a given encoding.
</para>
<para>
X11 core font instances are usually specified using a notation known
as the <emphasis remap="it">X Logical Font Description</emphasis> (XLFD). An XLFD starts with a
dash <quote><literal remap="tt">-</literal></quote>, and consists of fourteen fields separated by dashes,
for example:
<screen>
-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-1
</screen>
Or particular interest are the last two fields <quote><literal remap="tt">iso8859-1</literal></quote>, which
specify the font instance's encoding.
</para>
<para>
A scalable font is specified by an XLFD which contains zeroes instead
of some fields:
<screen>
-adobe-courier-medium-r-normal--0-0-0-0-m-0-iso8859-1
</screen>
</para>
<para>
X11 font instances may also be specified by short name. Unlike an
XLFD, a short name has no structure and is simply a conventional name
for a font instance. Two short names are of particular interest, as
the server will not start if font instances with these names cannot be
opened. These are <quote><literal remap="tt">fixed</literal></quote>, which specifies the fallback font to
use when the requested font cannot be opened, and <quote><literal remap="tt">cursor</literal></quote>, which
specifies the set of glyphs to be used by the mouse pointer.
</para>
<para>
Short names are usually implemented as aliases to XLFDs; the
standard <quote><literal remap="tt">fixed</literal></quote> and <quote><literal remap="tt">cursor</literal></quote> aliases are defined in
<screen>
/usr/share/font/X11/misc/fonts.alias
</screen>
</para>
</sect2>
<sect2 id='Unicode'>
<title>Unicode</title>
<para>
Unicode (<ulink
url="http://www.unicode.org"
>http://www.unicode.org</ulink
>) is a coded character
set with the goal of uniquely identifying all characters for all
scripts, current and historical. While Unicode was explicitly not
designed as a glyph encoding scheme, it is often possible to use it as
such.
</para>
<para>
Unicode is an <emphasis remap="it">open</emphasis> character set, meaning that codepoint
assignments may be added to Unicode at any time (once specified,
though, an assignment can never be changed). For this reason, a
Unicode font will be <emphasis remap="it">sparse</emphasis>, meaning that it only defines glyphs
for a subset of the character registry of Unicode.
</para>
<para>
The Unicode standard is defined in parallel with the international
standard ISO&nbsp;10646. Assignments in the two standards are always
equivalent, and we often use the terms <emphasis remap="it">Unicode</emphasis> and
<emphasis remap="it">ISO&nbsp;10646</emphasis> interchangeably.
</para>
<para>
When used in the X11 core fonts system, Unicode-encoded fonts should
have the last two fields of their XLFD set to <quote><literal remap="tt">iso10646-1</literal></quote>.
</para>
</sect2>
</sect1>
<sect1 id='References'>
<title>References</title>
<para>
X11R&relvers; comes with extensive documentation in the form of manual
pages and typeset documents. Before installing fonts, you really should
read the <ulink
url="fontconfig.3.html"
>fontconfig(3)</ulink
> and
<ulink
url="mkfontdir.1.html"
>mkfontdir(1)</ulink
> manual pages; other
manual pages of interest include <ulink
url="X.7.html"
>X(7)</ulink
>,
<ulink
url="Xserver.1.html"
>Xserver(1)</ulink
>, <ulink
url="xset.1.html"
>xset(1)</ulink
>, <ulink
url="Xft.3.html"
>Xft(3)</ulink
>, <ulink
url="xlsfonts.1.html"
>xlsfonts(1)</ulink
> and <ulink
url="showfont.1.html"
>showfont(1)</ulink
>. In addition, you may want to read the <olink targetdoc='xlfd'
targetptr='xlfd'>X Logical Font Description document</olink> by Jim Flowers.
</para>
<para>
The <ulink
url="http://www.faqs.org/faqs/by-newsgroup/comp/comp.fonts.html"
>comp.fonts FAQ</ulink
>,
which is unfortunately no longer being maintained, contains a wealth
of information about digital fonts.
</para>
<para>
Xft and Fontconfig are described on
<ulink
url="http://www.fontconfig.org"
>the Fontconfig site</ulink
>.
</para>
<para>
The
<ulink
url="http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/"
>xfsft home page</ulink
>
has been superseded by this document, and is now obsolete; you may
however still find some of the information that it contains useful.
<ulink
url="http://www.joerg-pommnitz.de/TrueType/xfsft.html"
>Joerg Pommnitz' xfsft page</ulink
>
is the canonical source for the <quote><command>ttmkfdir</command></quote> utility, which is the
ancestor of <command>mkfontscale</command>.
</para>
<para>
<ulink
url="http://www.pps.jussieu.fr/~jch/software/"
>The author's software pages</ulink
>
might or might not contain related scribbles and development versions
of software.
</para>
<para>
The documentation of <emphasis remap="it">X-TrueType</emphasis> is available from <ulink
url="http://x-tt.sourceforge.jp/"
>the After X-TT Project page</ulink
>.
</para>
<para>
While the <ulink
url="http://www.unicode.org"
>Unicode consortium site</ulink
>
may be of interest, you are more likely to find what you need in
Markus Kuhn's <ulink
url="http://www.cl.cam.ac.uk/~mgk25/unicode.html"
>UTF-8 and Unicode FAQ</ulink
>.
</para>
<para>
The IETF RFC documents, available from a number of sites throughout
the world, often provide interesting information about character set
issues; see for example <ulink
url="https://datatracker.ietf.org/doc/rfc373/">RFC&nbsp;373</ulink>.
</para>
</sect1>
</article>