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
.
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.
XFS
If you have not already done so, install main/binary-*/x11/xfs_*.deb
.
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
XFS
Restart XFS
in the usual Debian manner:
root shell
# /etc/init.d/xfs restart
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
....
/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
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
.
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
....
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
.
XFSTT
If you have not already done so, install main/binary-*/x11/xfstt_*.deb
.
Copy your TrueType fonts into the /usr/share/fonts/truetype
directory. These files usually have a .ttf
extension, and they
should have 0444
permissions.
XFSTT
Font Server
Restart the xfstt
server with the force-reload
flag
root shell
# /etc/init.d/xfstt force-reload
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
/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
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
....
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.
If you are using the xfstt
font server, it's trivial to install
additional TrueType fonts.
/usr/share/fonts/truetype/
xfs
with /etc/init.d/xfs restart
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:
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
http://ppewww.ph.gla.ac.uk/%7Eflavell/iso8859/iso8859-pointers.html
,
http://anubis.dkuug.dk/i18n/
and
http://czyborra.com/charsets/iso8859.html
.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.