Table of Contents

Debian Font Configuration

This is a description of how to setup a Debian system in a way that you have nice fonts in X and can display websites in various languages as the web designer intended it.

I assume you use Debian sarge (currently stable) with XFree 4.1.x

Basic Packages

We need some tools to manage fonts in Debian:

#> apt-get install defoma fontconfig ttmkfdir cabextract

The latter one is used to extract Microsoft exe file - we'll come to this later.

X-Server Setup

Now we need to edit the /etc/X11/XF86Config-4 to use TrueType fonts when available. Just change your files section to look like this:

Section "Files"
        FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
        FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
        FontPath        "/usr/share/fonts/truetype"
        FontPath        "/usr/local/share/fonts/truetype"
        FontPath        "/usr/lib/X11/fonts/CID"
        FontPath        "/usr/lib/X11/fonts/Speedo"
        FontPath        "/usr/lib/X11/fonts/misc"
        FontPath        "/usr/lib/X11/fonts/cyrillic"
        FontPath        "/usr/lib/X11/fonts/100dpi:unscaled"
        FontPath        "/usr/lib/X11/fonts/75dpi:unscaled"
        FontPath        "/usr/lib/X11/fonts/Type1"
EndSection

So what does it do? It tells X where to look for fonts. The order is important as the upper ones are checked first. So we use Defoma managed fonts first, then packaged truetype fonts and then our own. The :unscaled options make sure bitmap fonts are not scaled (looks terrible).

Restart the X server to make sure it obeys the new order.

Setup Fontconfig

Fontconfig is used by modern programs (eg. Mozilla Firefox) to find fonts. We will install our own fonts to /usr/local/share/fonts. To let fontconfig pick up these fonts you need to put this path into /etc/fonts/local.conf. Add this line between <fontconfig> and </fontconfig>:

  <dir>/usr/local/share/fonts</dir>

Yip you guessed right this file is in XML syntax. If you don't have a local.conf file yet, create one using this example:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/local.conf file to configure system font access -->
<fontconfig>
  <dir>/usr/local/share/fonts</dir>
</fontconfig>

You can get a list of all fonts known to fontconfig with

$> fc-list

Installing packaged fonts

This is easy - just install the packages. Here is a list of packages I recommend.

These are the basic font X font files (in various encodings):

#> apt-get install xfonts-100dpi xfonts-100dpi-transcoded \
                   xfonts-75dpi xfonts-75dpi-transcoded \
                   xfonts-base xfonts-base-transcoded

The next one installs the very good and free bitstream fonts and some fonts distributed by Microsoft (including the famous “MS Comic Sans” ;-))

#> apt-get install ttf-bitstream-vera msttcorefonts

And finally these contain some international and unicode characters

#> apt-get install ttf-junicode ttf-kochi-gothic ttf-kochi-mincho

Installing aditional TTFs

To have proper Unicodesupport when visiting foreign websites you need some unicode fonts. The best (most complete) known font is “Arial Unicode MS” once available for download from Microsoft, today only distributed with MS Office, but also at various other places on the web. I recommend http://orwell.ru/test/download/ which contains some other fonts, too.

To install the Arial font get it from the website and extract the exe file with cab extract:

$> wget http://orwell.ru.nyud.net:8090/download/aruniupd.exe
$> cabextract aruniupd.exe

Then copy it to the local fontdir:

#> mkdir -p /usr/local/share/fonts/truetype/
#> cp Arialuni.TTF /usr/local/share/fonts/truetype/

Then update the fonts information in the directory

#> cd /usr/local/share/fonts/truetype/
#> mkfontscale
#> mkfontdir

Okay let's do it again for the other files

$> wget http://orwell.ru.nyud.net:8090/download/cyberbit.zip
$> wget http://orwell.ru.nyud.net:8090/download/code2000.zip
$> wget http://orwell.ru.nyud.net:8090/download/lsansuni.zip
$> wget http://orwell.ru.nyud.net:8090/download/palab.zip
$> wget http://orwell.ru.nyud.net:8090/download/xsuni.zip
$> # Gothic:
$> wget http://www.keidan.it/assets/Vulcanius.zip
$> # Cherokee:
$> wget http://www.languagegeek.com/font/absans.zip
$> for font in *.zip; do unzip $font; done
$>
$> # Inuktitut:
$> wget http://www.gov.nu.ca/Pigiarniq%20Regular.ttf
$> # Khmer:
$> wget http://www.camboday.com/fonts/CDT%20Khmer.ttf
$> 
#> cp *.TTF *.ttf /usr/local/share/fonts/truetype/
#> cd /usr/local/share/fonts/truetype/
#> mkfontscale
#> mkfontdir