(M)  s i s t e m a   o p e r a c i o n a l   m a g n u x   l i n u x ~/ · documentação · suporte · sobre

  Next Previous Contents

3. Display (X and the font servers)

Strictly speaking, it is not absolutely necessary to set up font servers to use TrueType fonts with X servers. If you wish to use static files instead of a font server, please see the instructions for setting up TrueType fonts for ghostscript.

3.1 Setting up the xfs Font Server

At this point I assume you have a working /etc/X11/XF86Config file that loads explicitly specifies each directory in the FontPath. We will convert it to use the xfs Font Server.

  • Install XFS

    If you have not already done so, install main/binary-*/x11/xfs_*.deb.

  • Configure XFS

    Edit /etc/X11/xfs/config and change the catalogue to contain the contents of your FontList. You may also wish to change the default-resolutions value.

    /etc/X11/xfs/config
    # paths to search for fonts
    catalogue = 
        /usr/X11R6/lib/X11/fonts/100dpi/:unscaled,
        /usr/X11R6/lib/X11/fonts/75dpi/:unscaled,
        /usr/X11R6/lib/X11/fonts/misc/,
        /usr/X11R6/lib/X11/fonts/Speedo/,
        /usr/X11R6/lib/X11/fonts/Type1/,
        /usr/X11R6/lib/X11/fonts/100dpi/,
        /usr/X11R6/lib/X11/fonts/75dpi/
    # x1,y1,x2,y2,...
    default-resolutions = 100,100,75,75
    

  • Restart XFS

    Restart XFS in the usual Debian manner:

    root shell
    # /etc/init.d/xfs restart
    

  • Verify that XFS is working

    Before we change our XF86Config file, we should verify that the xfs server is working by listing them through the font server:

    user shell
    $ fslsfonts -server unix/:7100
    -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1
    -adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-1
    -adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-1
    ....
    

  • Change /etc/X11/XF86Config to use xfs

    We're now ready to tell the X server to use the xfs font server. We keep one static font path as a fallback position in case of a problem with xfs. (We keep "misc" since it contains fixed, the default font.)

    /etc/X11/XF86Config
    Section "Files"
        FontPath   "unix/:7100"
        FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
    EndSection
    

  • Restart X

    Restart X with startx, unless you like living life dangerously. If that's the case, name me the beneficiary of your unusually large life insurance policy and restart xdm.

  • Verify that the XFS fonts are visible

    Once we have an X session established, we can verify that our server sees all of the xfs fonts by listing them through the X server.

    user shell
    $ xlsfonts
    -adobe-courier-bold-i-normal--0-0-0-0-m-0-iso8859-1
    -adobe-courier-bold-o-normal--0-0-100-100-m-0-iso8859-1
    -adobe-courier-bold-o-normal--0-0-75-75-m-0-iso8859-1
    ....
    

3.2 Setting up the xfstt Font Server and installing TrueType fonts

At this point I assume you have a working xfs font server and wish to add TrueType support via xfstt.

  • Install XFSTT

    If you have not already done so, install main/binary-*/x11/xfstt_*.deb.

  • Installing the TrueType Fonts

    Copy your TrueType fonts into the /usr/share/fonts/truetype directory. These files usually have a .ttf extension, and they should have 0444 permissions.

  • Restart the XFSTT Font Server

    Restart the xfstt server with the force-reload flag

    root shell
    # /etc/init.d/xfstt force-reload
    

  • Verify that XFSTT is working

    Before we change our XF86Config file, we should verify that the xfstt server is working.

    Important: the Debian xfstt server listens to port 7101, not 7100. Also, the default permissions will require you to run this query as root.

    user and root shells
    $ fslsfonts -server unix/:7101
    _FSTransSocketUNIXConnect: Can't connect: errno = 111
    fslsfonts:  unable to open server "unix/:7101"
    
    # fslsfonts -server unix/:7101
    -ttf-arial black-medium-r-normal-regular-0-0-0-0-p-0-iso8859-1
    -ttf-arial mt black-medium-r-normal-regular-0-0-0-0-p-0-iso8859-1
    -ttf-arial narrow-bold-i-normal-bold italic-0-0-0-0-p-0-iso8859-1
    

  • Change /etc/X11/XF86Config to use xfstt

    We're now ready to tell the X server to use the xfstt font server. We want it to use TrueType fonts in preference to all others.

    /etc/X11/XF86Config
    Section "Files"
        FontPath   "unix/:7101"
        FontPath   "unix/:7100"
        FontPath   "/usr/X11R6/lib/X11/fonts/misc/"
    EndSection
    

  • Verify that XFSTT fonts are visible

    Once we have an X session established, we can verify that our server sees all of the TrueType fonts by listing them.


    $ xlsfonts | grep ttf
    -ttf-arial black-medium-r-normal-regular-0-0-0-0-p-0-iso8859-1
    -ttf-arial mt black-medium-r-normal-regular-0-0-0-0-p-0-iso8859-1
    -ttf-arial narrow-bold-i-normal-bold italic-0-0-0-0-p-0-iso8859-1
    ....
    

3.3 Using TrueType fonts

At this point it should be possible to use a TrueType font in applications like GIMP, Netscape or StarOffice. Since most TrueType fonts aren't monospaced you probably don't want to use one of them with xterm - these programs use monospacing the size of the largest character cell.

3.4 Installing additional TrueType fonts

If you are using the xfstt font server, it's trivial to install additional TrueType fonts.

  • Copy the new font(s) into /usr/share/fonts/truetype/
  • Restart xfs with /etc/init.d/xfs restart

3.5 Internationalization

xfstt has the ability to generate multiple font encodings, provided that the TrueType font contains the necessary glyphs. To enable fonts other than iso8859-1/unicode-1, you must manually edit the /etc/init.d/xfstt script:

/etc/init.d/xfstt
- start-stop-daemon --start --quiet --exec $XFSTT -- \
      --port $portno --daemon 
+ start-stop-daemon --start --quiet --exec $XFSTT -- \
      --port $portno --encoding iso8859-1,koi8-r,windows-1252,symbol-0 \
      --daemon 

The recognized encodings in Debian 2.1 are:

  • iso8859-1 (Latin 1 - Western Europe)
  • iso8859-2 (Latin 2 - Central and Eastern Europe)
  • iso8859-3 (Latin 3 - Esperanto and Maltese)
  • iso8859-4 (Latin 4 - superceded by Latin 6)
  • iso8859-5 (Cyrillic)
  • iso8859-6 (Arabic)
  • iso8859-7 (Greek)
  • iso8859-8 (Hebrew)
  • iso8859-9 (Latin 5 - Latin 1 with Turkish, not Icelandic)
  • iso8859-10 (Latin 6 - Nordic languages, replaces Latin 4)
  • koi8-r (Cyrillic)
  • windows-1250 (Central Europe)
  • windows-1251 (Cyrillic)
  • windows-1252
  • windows-1253 (Greek)
  • windows-1254
  • windows-1255
  • windows-1256
  • windows-1257
  • symbol-0
  • wingding-0
  • wingreek-0
  • cp-437 (various IBM code pages)
  • cp-737
  • cp-850
  • cp-851
  • cp-852
  • cp-853
  • cp-855
  • cp-857
  • cp-860
  • cp-861
  • cp-862
  • cp-863
  • cp-864
  • cp-865
  • cp-866
  • cp-869
  • cp-895
  • atari-st
  • unicode-2

The first 128 characters in the iso8859-x encodings is always ASCII. The windows- fonts embrace and extend iso8859-1 with additional characters such as "smart quotes." (Since these extensions, such as "smart quotes" are undefined in iso8859-1, they are usually rendered as question marks.)

Excellent source for additional information on character set encodings are at

3.6 Security Issues

I used Unix sockets above, but the standard Debian packages also configure xfs and xfstt to listen to TCP/IP ports 7100 and 7101, respectively. Access to these ports should be controlled by the trusted-clients field in /etc/X11/xfs/config, but this option is not implemented in XFree86 3.3.2.3a.

This means that anyone, anywhere, can connect to your font server. Since xfs (and presumably xfsts) "clone" to support more users there's a trivial denial-of-service attack against these systems. It's probably safe to use the font servers on dialup lines (since you're present to handle problems), but DSL and cable modem users should use a firewall.


Next Previous Contents