<!--#include virtual="HTML_begin.inc"-->
  <title>Installing Fonts on X11</title>
  <meta name="keywords" content="Computer, Linux, FreeBSD"/>
  <meta name="keywords" content="bitmap, scalable, fonts, xft, x11, fc-cache, \
    fc-list, hinting truetype, bytecode interpreter"/>
<!--#include virtual="HTML_head_end.inc"-->
<!--#include virtual="Computer_tabs.inc"-->

<div id="content">
<h2>Installing Fonts on X</h2>

<h3>Resources:</h3>
  <ul>
    <li><a
        href="http://netmirror.org/mirror/xfree86.org/4.0.2/doc/README.fonts">
        README.fonts</a> - this is a very good&mdash;make that,
        essential&mdash;resource.</li>

    <li>man - X, Xft, fc-cache, fc-list</li>
  </ul>

<p>Notes on fonts [incomplete]:</p>
  <ul>
    <li>Bitmap fonts:
      <ul>
        <li>bdf are converted to pcf using bdftopcf.</li>
        <li>snf is an obsolete font format.</li>
      </ul>
    </li>
    <li>Scalable fonts:
      <ul>
        <li>Speedo - spd</li>
        <li>FreeType:
          <ul>  
            <li>TrueType - ttf, ttc</li>
            <li>OpenType - otf, otc</li> 
            <li>Type 1 - pfa, pfb</li>
            <li>CIDFont - </li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>

<h3>Introduction</h3>

  <p>X11 currently uses two font systems: the original core fonts system, which
  will be referred to as the legacy system in this document, and the
  <tt>Xft</tt> font system.</p>

<h3>Installing Fonts on Linux</h3>

  <ul>
    <li>X11 legacy method:
    <ul>

      <li>Place font file in <tt>font_directory</tt>.</li>

      <li><tt>mkfontscale [font_directory]</tt> - needed for scalable fonts
          only.</li>

      <li><tt>mkfontdir [font_directory]</tt> - needed for scalable and bitmap
          fonts.</li>

      <li><tt>xset fp+ font_directory</tt> - temporarily make fonts available
          to X11.</li>

      <li>Edit <tt>XF86Config</tt> or <tt>xorg.conf</tt> to make fonts
      available to X permanently by adding something like the following to
      <tt>Section "Files"</tt>:

        <ul>
          <li><tt>FontPath     "/ . . . / . . . /font_directory"</tt></li>
        </ul>

      </li>
    </ul>
    </li>

    <li>Xft method:
      <ul>

        <li>Place font file in <tt>font_directory</tt>.</li>

        <li>Don't mess with <tt>/etc/fonts/fonts.conf</tt>, instead,
        add font_directory to <tt>/etc/fonts/local.conf</tt> or
        <tt>~/.fonts.conf</tt> if necessary. (You'll have to read a
        little in the <tt>README.fonts</tt> file to make
        <tt>local.conf</tt> a proper xml file.)

          <ul>
           <li>Example:
           <tt>&lt;dir&gt;/usr/local/share/fonts/font_directory&lt;/dir&gt;</tt>
           </li>
          </ul>
        </li>

        <li>Run <tt>fc-cache</tt> to update an index of all the
        available fonts from the directories listed in the
        <tt>fonts.conf</tt>, <tt>local.conf</tt>, etc. files.  It will
        also create a <tt>fonts.cache-1</tt> file in the appropriate
        directories.</li>

        <li><tt>fc-cache</tt> is, usually, run automatically at boot
        time by the <tt>rc</tt> scripts on most distibutions.  If not,
        fix the rc scripts to run fc-cache.</li>

        <li><tt>fc-list</tt> will list all available fonts.</li>

      </ul>
    </li>
  </ul>

<h3>Using Xft</h3>
  <ul>
    <li>Xterm: <tt>xterm -fa "Courier"</tt></li>

    <li>GTK+ 2.0 programs: <tt>export GDK_USE_XFT=1</tt></li>

    <li>GTK+ 2.2 uses Xft by default.</li>

    <li>Firefox 1.0.7 uses Xft by default.</li>

    <li>Sylpheed seems to uses Xft by default.</li>
  </ul>

<hr/>

<h3>FreeType setup for hinting TrueType fonts:</h3>

  <p>The bytecode interpreter is usually not enabled in Linux releases
  because of patents owned by Apple Computer. After reading the <a
  href="http://www.freetype.org/patents.html">information concerning
  these patents</a>, you can make a decision as to whether you will
  enable the bytecode interpreter in FreeType. If you are so inclined
  start by downloading and installing the latest <a
  href="http://www.freetype.org/">FreeType</a> from source. Use it to
  update your existing libs. (I've successfully done this with
  <tt>FreeType 2.1.10</tt> and <tt>FreeType 2.3.3</tt> on Slackware
  10.0 and 11.0.)</p>

  <ol>

    <li>Untar the source and <tt>cd</tt> to the source directory.</li>

    <li>Edit <tt>include/freetype/config/ftoption.h</tt> and make the
    following happen:

      <ul>
        <li><tt>#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER</tt></li>
      </ul>
    </li>

    <li><tt>./configure --prefix=/usr</tt></li>

    <li><tt>make</tt></li>

    <li><tt>make install</tt></li>

    <li><tt>/sbin/ldconfig</tt></li>

  </ol>

  <p>The source for FreeType contains more information in the form of
  README's. It is a good idea to read all the information that is available
  before installing any stuff on your machine.</p>

  <p>After making the changes you will probably notice some improvement in the
  way fonts look in some of your applications. I've successfully done this to
  Slackware 10.0 and 10.2. The new libs will over-write the old ones and you're
  on your way.</p>
 
  <p>RPM to do this? You don't need no stinking RPMs.</p>

</div>

<p class="lastupdate">Last updated: <!--#echo var="LAST_MODIFIED" --></p>
<!--#include virtual="HTML_end.inc"-->
