Author: dnicholson
Date: 2006-03-28 07:59:36 -0700 (Tue, 28 Mar 2006)
New Revision: 5765
Modified:
trunk/BOOK/introduction/welcome/changelog.xml
trunk/BOOK/x/installing/x-setup.xml
Log:
Reworking of font section in X Window System Components
Modified: trunk/BOOK/introduction/welcome/changelog.xml
===================================================================
--- trunk/BOOK/introduction/welcome/changelog.xml 2006-03-28 14:55:44 UTC
(rev 5764)
+++ trunk/BOOK/introduction/welcome/changelog.xml 2006-03-28 14:59:36 UTC
(rev 5765)
@@ -45,6 +45,11 @@
<para>March 28th, 2006</para>
<itemizedlist>
<listitem>
+ <para>[dnicholson] - Reworked the fonts section of X Window System
+ Components. Added detailed description of both font services and
+ more links to available fonts.</para>
+ </listitem>
+ <listitem>
<para>[dnicholson] - Added commands to make only TrueType fonts
available to Fontconfig in Xorg-6.9.0, Xorg-7.0.0 and XFree86-4.5.0.
Fixed name of luit patch in Xorg-6.9.0.</para>
Modified: trunk/BOOK/x/installing/x-setup.xml
===================================================================
--- trunk/BOOK/x/installing/x-setup.xml 2006-03-28 14:55:44 UTC (rev 5764)
+++ trunk/BOOK/x/installing/x-setup.xml 2006-03-28 14:59:36 UTC (rev 5765)
@@ -59,44 +59,17 @@
<!-- ================================================== -->
<sect2 id='fonts'>
- <title>Adding TrueType Fonts to X</title>
+ <title>Setting up Fonts</title>
- <para><application>TrueType</application> font support is built into
- <application>X</application>. The following items need to be
- completed to make the fonts available. Each item is described in
- detail after the list.</para>
+ <para>There are two font systems in the
+ <application>X Window System</application>. The first is the
+ core X font protocol, and the second is Xft. Toolkits that use the core
+ X font protocol include Xt, Xaw, Motif clones and GTK+-1.2. Toolkits that
+ use Xft include GTK+-2 and Qt and use <application>Fontconfig</application>
+ for control. Both font systems should be configured for proper font
+ coverage in the <application>X Window System</application>.</para>
<indexterm zone="x-setup fonts">
- <primary sortas="g-truetype">TrueType</primary>
- </indexterm>
-
- <itemizedlist>
- <listitem>
- <para>Establish a directory for the fonts and move any
- <application>TrueType</application> fonts you want into that
- directory. Ensure that any fonts you install are world readable.
- Incorrect permissions on fonts have been known to cause problems
- with some <application>X</application> applications.</para>
- </listitem>
- <listitem>
- <para>Download the fonts.</para>
- </listitem>
- <listitem>
- <para>Create the <filename>fonts.scale</filename> and
- <filename>fonts.dir</filename> files in the
- <application>TrueType</application> font directory.</para>
- </listitem>
- <listitem>
- <para>Ensure the <application>TrueType</application> module is
- loaded in the <filename>XF86Config</filename> or
- <filename>xorg.conf</filename>.</para>
- </listitem>
- <listitem>
- <para>Update the font cache files</para>
- </listitem>
- </itemizedlist>
-
- <indexterm zone="x-setup fonts">
<primary sortas="e-etc-X11-xorg-conf">/etc/X11/xorg.conf</primary>
</indexterm>
@@ -105,134 +78,224 @@
</indexterm>
<sect3>
- <title>Establish a TrueType Font Directory</title>
+ <title>Core X Font Protocol</title>
- <para>The build of <application>X</application> as given above
- automatically creates a <application>TrueType</application> font
- directory: <filename
- class="directory">/usr/share/fonts/TTF</filename>. This
- directory already has some <application>TrueType</application>
- fonts and is set up correctly. If this directory is satisfactory,
- copy any other <application>TrueType</application> fonts you want
- into that directory. If not, create a new directory, preferably
- in the <filename
- class="directory">/usr/share/fonts/</filename> directory
- and put your <application>TrueType</application> fonts there.</para>
-
- </sect3>
-
- <sect3>
- <title>Download the Fonts</title>
-
- <para>There are two known high quality free font resources:
- <ulink url="ftp://ftp.gnu.org/savannah/files/freefont/"/> and
- <ulink url="http://corefonts.sourceforge.net/"/>. Copy the fonts
- (files with the <filename>.ttf</filename> suffix) to the directory
- you've just created.</para>
-
- </sect3>
-
- <sect3 id="fonts-scale-dir">
- <title>Create 'fonts.scale' and 'fonts.dir'</title>
-
- <indexterm zone="x-setup fonts-scale-dir">
- <primary sortas="g-fonts.scale">fonts.scale</primary>
+ <indexterm zone="x-setup fonts">
+ <primary sortas="g-core-x-font">Core X Font Protocol</primary>
</indexterm>
- <indexterm zone="x-setup fonts-scale-dir">
- <primary sortas="g-fonts.dir">fonts.dir</primary>
- </indexterm>
+ <para>The core X font protocol finds fonts from the server configuration
+ file (<filename>xorg.conf</filename> or
<filename>XF86Config</filename>).
+ If no font paths exist in the configurations file, the server will fall
+ back to an internal hard-coded path. Assuming the prefix for your
+ <application>X</application> installation is
+ <filename class="directory">/usr/X11R6</filename>, the core fonts will
+ reside in subdirectories of <filename
+ class="directory">/usr/X11R6/lib/X11/fonts</filename>. For each
+ directory in the path, the server reads three files:</para>
- <para>Now change to the directory where you have your
- <application>TrueType</application> fonts and run:</para>
+ <itemizedlist>
+ <listitem>
+ <para><filename>fonts.dir</filename> - maps font files to font
+ names; updated with <command>mkfontdir</command></para>
+ </listitem>
+ <listitem>
+ <para><filename>fonts.alias</filename> - defines aliases (such as
+ "9x18") for existing fonts</para>
+ </listitem>
+ <listitem>
+ <para><filename>fonts.scale</filename> - lists scalable fonts;
+ updated with <command>mkfontscale</command></para>
+ </listitem>
+ </itemizedlist>
-<screen role="root"><userinput>mkfontscale &&
-mkfontdir</userinput></screen>
+ <para>The core X fonts protocol uses names such as
+
<systemitem>-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1</systemitem>.
+ These fonts are rendered by the <application>X</application> server
+ without antialiasing. The server itself uses the "cursor" font for
+ painting the mouse cursor, and the protocol specification requires the
+ font "fixed" to be available.</para>
- <indexterm zone="x-setup fonts-scale-dir">
- <primary sortas="b-mkfontscale">mkfontscale</primary>
- </indexterm>
+ <para>Scalable fonts, such as Type1 and TrueType, are read from
+ <filename>fonts.scale</filename> files by the server. The core X font
+ system uses the "freetype" module for non-antialiased rendering of these
+ fonts. Ensure that the "freetype" module is loaded in the
+ <filename>XF86config</filename> or <filename>xorg.conf</filename>
+ file by adding it to the "Module" section:</para>
- <indexterm zone="x-setup fonts-scale-dir">
- <primary sortas="b-mkfontdir">mkfontdir</primary>
- </indexterm>
-
- </sect3>
-
- <sect3>
- <title>Ensure TrueType is Loaded in 'XF86Config' or 'xorg.conf'</title>
-
- <para>The "Module" section should look like:</para>
-
<screen><literal>Section "Module"
...
Load "freetype"
...
EndSection</literal></screen>
+ <para>The character set used is part of the font name, e.g.
"-iso8859-1".
+ It is important that applications which support a non-English interface
+ specify the character set correctly so that the proper glyphs are used.
+ This can be controlled through the <application>X</application>
+ resources, which will be described later.</para>
+
+ <para>In some cases, applications rely upon the fonts named "fixed" or
+ something like "9x18". In these cases, it is important that the
+ <filename>fonts.alias</filename> file specifies the correct character
+ set. Users of ISO-8859-<replaceable>X</replaceable> encodings where
+ <replaceable>X</replaceable> != 1 should modify the
+ <filename>/usr/lib/X11/fonts/misc/fonts.alias</filename> file by
+ replacing the "iso8859-1" string with the proper encoding name. This is
+ accomplished by running the following command as the <systemitem
+ class="username">root</systemitem> user, substituting the proper value
+ for <replaceable>[X]</replaceable>:</para>
+
+<screen role="root"><userinput>sed -i 's,iso8859-1\(
\|$\),iso8859-<replaceable>[X]</replaceable>\1,g' \
+ /usr/share/fonts/{75dpi,100dpi,misc}/fonts.alias</userinput></screen>
+
+ <para>Users of Cyrillic fonts have properly defined aliases in
+ <filename>/usr/lib/X11/fonts/cyrillic/fonts.alias</filename>. However,
+ this file will not be used unless the <filename
+ class="directory">/usr/lib/X11/fonts/cyrillic</filename> directory is
+ first in the font search path. Otherwise, the
+ <filename>/usr/lib/X11/fonts/misc/fonts.alias</filename> file will be
+ used.</para>
+
</sect3>
<sect3>
- <title>Update the Font Cache Files</title>
+ <title>Xft Font Protocol</title>
- <para>If you decided not to install X windows fonts into
- <filename class='directory'>/usr/share/fonts</filename>, then
- ensure you have the following directory entries in
- <filename>/etc/fonts/local.conf</filename>, inside the <fontconfig>
- tags. Create <filename>/etc/fonts/local.conf</filename> using the
- following commands:</para>
-
<indexterm zone="x-setup fonts">
- <primary
sortas="e-etc-fonts-local.conf">/etc/fonts/local.conf</primary>
+ <primary sortas="g-truetype">TrueType Fonts</primary>
</indexterm>
-<screen role="root"><userinput>cat > /etc/fonts/local.conf << "EOF"
-<literal><?xml version="1.0"?>
-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
-<!-- /etc/fonts/local.conf file for local customizations -->
+ <para>Xft provides antialiased font rendering through
+ <application>Freetype</application>, and fonts are controlled from the
+ client side using <application>Fontconfig</application>. The default
+ search path is <filename class="directory">/usr/share/fonts</filename>
+ and <filename class="directory">~/.fonts</filename>.
+ When installing <application>X</application>, symlinks were created from
+ the <filename class="directory">OTF</filename> and <filename
+ class="directory">TTF</filename> <application>X</application> font
+ directories to <filename
+ class="directory">/usr/share/fonts/X11-{OTF,TTF}</filename>. This
+ prevents <application>Fontconfig</application> from using the poorly
+ rendered Type1 fonts or the non-scalable bitmapped fonts.</para>
-<fontconfig>
-<dir>/usr/X11R6/lib/X11/fonts/TTF</dir>
-<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
-</fontconfig></literal>
+ <para><application>Fontconfig</application> searches directories in its
+ path recursively and maintains a cache of the font characteristics in
+ <filename>fonts.cache-1</filename> files in each directory. If the cache
+ appears to be out of date, it is ignored, and information is (slowly)
+ fetched from the fonts themselves. This cache
+ can be regenerated using the <command>fc-cache</command> command at any
+ time.</para>
-EOF</userinput></screen>
+ <para><application>Fontconfig</application> uses names such as
+ "Monospace 12" to define fonts. Applications generally use generic font
+ names such as "Monospace", "Sans" and "Serif".
+ <application>Fontconfig</application> resolves these names to a font that
+ has all characters that cover the orthography of the language indicated
+ by the locale settings. Knowledge of these font names is included in
+ <filename>/etc/fonts/fonts.conf</filename>.</para>
+ <para>Standard scalable fonts that come with <application>X</application>
+ provide very poor Unicode coverage. You may notice in applications that
+ use <application>Xft</application> that some characters appear as a box
+ with four binary digits inside. In this case, a font set with the
+ available glyphs has not been found. Other times, applications that
+ don't use other font families by default and don't accept substitutions
+ from <application>Fontconfig</application> will display blank lines when
+ the default font doesn't cover the orthography of the user's language.
+ This happens, e.g., with <application>Fluxbox</application> in the
+ ru_RU.KOI8-R locale.</para>
-<!--
-<screen><userinput><command>sed -i -e '/^<\/fontconfig>/i\
-<dir>/usr/X11R6/lib/X11/fonts/TTF</dir>\
-<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>'
/etc/fonts/local.conf</command></userinput></screen>
- -->
+ <para>In order to provide greater Unicode coverage, it is recommended
+ that you install these fonts:</para>
- <para>The <command>fc-cache</command> program will automatically
- search the above directories and all subdirectories for needed
- fonts.</para>
+ <itemizedlist>
+ <listitem>
+ <para><ulink url="http://dejavu.sourceforge.net/">DejaVu
fonts</ulink>
+ - These fonts are replacements for the Bitstream Vera fonts and
+ provide Latin-based scripts with accents and Cyrillic glyphs.
+ <application>Fontconfig</application> does not know about the DejaVu
+ fonts by default, so <filename>/etc/fonts/fonts.conf</filename> will
+ have to be edited for it to be recognized by the generic names such
+ as "Sans". This will be described below.</para>
+ </listitem>
+ <listitem>
+ <para><ulink
+
url="http://download.savannah.nongnu.org/releases/freefont/">FreeFont</ulink>
+ - This set of fonts covers nearly every non-CJK character, but is not
+ visually pleasing. <application>Fontconfig</application> will use it
+ as a last resort to substitute generic font family names.</para>
+ </listitem>
+ <listitem>
+ <para><ulink
+ url="http://corefonts.sourceforge.net/">Microsoft Core fonts</ulink>
+ - These fonts provide slightly worse Unicode coverage than FreeFont,
+ but are better hinted. Be sure to read the license before using
+ them. <application>Fontconfig</application> knows about them by
+ default.</para>
+ </listitem>
+ <listitem>
+ <para><ulink
+ url="http://cle.linux.org.tw/fonts/FireFly">Firefly New Sung
font</ulink>
+ - This font provides Chinese coverage. However,
+ <application>Fontconfig</application>does not know about this font
+ by default.</para>
+ </listitem>
+ <listitem>
+ <para><ulink
+ url="http://cle.linux.org.tw/fonts/Arphic">Arphic fonts</ulink> -
+ A similar set of Chinese fonts to the Firefly New Sung font.
+ <application>Fontconfig</application> knows about these fonts by
+ default and will substitute them for generic family names.</para>
+ </listitem>
+ <listitem>
+ <para><ulink
+ url="http://sourceforge.jp/projects/efont/">Kochi fonts</ulink> -
+ These provide Japanese characters, and
+ <application>Fontconfig</application> knows about these fonts by
+ default.</para>
+ </listitem>
+ <listitem>
+ <para><ulink
+ url="http://kldp.net/projects/baekmuk/">Baekmuk fonts</ulink>
+ - These fonts provide Korean coverage, and
+ <application>Fontconfig</application> knows about these fonts by
+ default.</para>
+ </listitem>
+ </itemizedlist>
- <para>Finally, to update all the font cache files, run</para>
+ <para>The list above will not provide complete Unicode coverage. For
+ more information, please visit the <ulink
+ url="http://unifont.org/fontguide/">Unicode Font Guide</ulink>.</para>
-<screen role="root"><userinput>fc-cache</userinput></screen>
+ <para>As an example, consider the installation of the DejaVu fonts. From
+ the unpacked source directory, run the following commands as the
+ <systemitem class="username">root</systemitem> user:</para>
- <indexterm zone="x-setup fonts">
- <primary sortas="b-fc-cache">fc-cache</primary>
- </indexterm>
+<screen role="root"><userinput>install -v -d -m755 /usr/share/fonts/dejavu
&&
+install -v -m644 *.ttf /usr/share/fonts/dejavu &&
+fc-cache -v /usr/share/fonts/dejavu</userinput></screen>
- <para><application>X</application> will now be able to use
- <application>TrueType</application> fonts when it is restarted.
- You can check to see if the new fonts are available with the
- <command>xlsfonts</command> or <command>xfontsel</command>
- program.</para>
+ <para>Earlier it was mentioned that
<filename>/etc/fonts/fonts.conf</filename>
+ could be modified to use DejaVu using the default family names. Since
+ DejaVu is a replacement for Bitstream Vera fonts, we can substitute it
+ for that family. Visually inspect the <filename>fonts.conf</filename> to
+ see how fonts are grouped together under the generic family names and a
+ preference list is created. To replace Bitstream Vera with DejaVu, as
the
+ <systemitem class="username">root</systemitem> user:</para>
- <note>
- <para>You should rerun <command>mkfontscale</command> and
- <command>mkfontdir</command> any time you add or delete
- <application>TrueType</application> fonts.
- You should also rerun <command>fc-cache</command> each time
- you add or remove any fonts.</para>
- </note>
+<screen role="root"><userinput>sed -i 's/<family>Bitstream
Vera/<family>DejaVu/' /etc/fonts/fonts.conf</userinput></screen>
</sect3>
+<!--
+<screen><userinput><command>sed -i -e '/^<\/fontconfig>/i\
+<dir>/usr/X11R6/lib/X11/fonts/TTF</dir>\
+<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>'
/etc/fonts/local.conf</command></userinput></screen>
+ -->
+ <bridgehead renderas="sect3" condition="html" role="usernotes">User Notes:
+ <ulink url='&blfs-wiki;/XWindowSystemComponents'/></bridgehead>
+
</sect2>
<!-- ================================================== -->
@@ -263,31 +326,6 @@
<!-- ================================================== -->
- <sect2>
- <title>Setting up Fonts</title>
-
- <para>Users using character sets other than ISO-8859-1 have to make
- a few adjustments to their font settings in order to make sure that
- fonts with the correct encoding are used for "fixed", "variable",
- "10x20" and similar aliases. For ISO-8859-<replaceable>[X]</replaceable>
- based locales, use the following command:</para>
-
-<screen role="root"><userinput>sed -i 's,iso8859-1\(
\|$\),iso8859-<replaceable>[X]</replaceable>\1,g' \
- /usr/share/fonts/{75dpi,100dpi,misc}/fonts.alias</userinput></screen>
-
- <para>To use cyrillic fonts with <application>GTK1</application>,
- <application>Tk</application>, <application>Xaw</application> and
- <application>Motif</application>, put the following line into the top of
the
- "Files" section in <filename>XF86Config</filename> or
- <filename>xorg.conf</filename>. This directory already contains the needed
bitmap
- fonts and their aliases:</para>
-
-<screen><literal>FontPath "/usr/share/fonts/cyrillic/"</literal></screen>
-
- </sect2>
-
-<!-- ================================================== -->
-
<sect2 id='xdm'>
<title>Setting up XDM</title>
--
http://linuxfromscratch.org/mailman/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page