The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
True Type fonts and XFree86 --- by Jim Weeks 15 July 2000
Need more help on this topic? Click here
This article has 4 comments
Show me similar articles
Jim Weeks wrote in to tell us about true type fonts under X.  He told me about this back in May, but I'm only just getting around to posting the message.  Sorry.  And thanks Jim.

Note: I have made some changes to Jim's text.  Any mistakes are therefore mostly likely mine.

Note: Previous versions of this article referred to port 7100, which is incorrect.   This mistake has been fixed by referring to port 7101 instead.

Installing the XfStt port
The following operation requires root access.

The easiest way to use TrueType (*.ttf) fonts in FreeBSD/XFree86 is to first install XfStt from the ports collection.  This port is found under X11-servers (/usr/ports/x11-servers/Xfstt/).   See Installing a port without installing the ports or Installing all the ports for more information about installing a port.  But in short, you do this:

cd /usr/ports/x11-servers/Xfstt/
make install
Getting the fonts
Once that port is installed, you need to create the directory /usr/X11R6/lib/X11/fonts/TrueType which is where XfStt looks for fonts.  Next, you should populate the directory with fonts.  TrueType (*.ttf) fonts are easily found and several are even available for download on the Microsoft web site.  One way to get the fonts is to zip the font directory on that old MS Windows machine before you reformat the drive for FreeBSD.   If you are lucky enough to have the old machine on a local network you may want to ftp the fonts over to your FreeBSD machine.

These are also good spots.

http://rover.wiesbaden.netsurf.de:80/%7Ekikita/zip/
http://rover.wiesbaden.netsurf.de/~kikita/zip/atman.zip
http://www.microsoft.com/typography/fontpack/default.htm

Check also the FAQ for xfstt for a list of sites (if you've done a make clean, you can get the FAQ back by doing this: .

tar zxvf /usr/ports/distfiles/xfstt-1.1.tar.gz xfstt-1.1/FAQ

Once you have the fonts in your new TrueType directory you are ready to start the server.

Starting the server
You can start it by simply typing "xfstt &" at the command prompt.   You should insure that xfstt is started at boot time.  This is easily accomplished by adding the following lines to a script in /usr/local/etc/rc.d.   Call the script xfstt.sh, and add the following lines:
#!/bin/sh
[ -x /usr/X11R6/bin/xfstt ] && /usr/X11R6/bin/xfstt & && echo -n ' XFstt'

You may also wish to customize this script based upon the man xfstt page.

Font database synchronization
The font database will be synchronized the first time you start the server.  If you wish to add fonts later you will need to stop the server and type:
xfstt --sync

to re-synchronize the database.

Tell X all about it
The last thing you need to do is make Xfree86 recognize your new fonts.  In order to do this you will need to add the following line to your list of fonts in /etc/XF86Config:
FontPath "unix/:7101"

where "7101" is the default port for the native FreeBSD version of XfStt.   You should now be ready to start X and test your installation.

Checking that it's all working...
If you have Netscape installed you can check under Edit/Preferences/Fonts.  The new fonts should now be visible in the Variable width fonts menu.

If you don't have Netscape, you can always run xfontsel. And this will show you fonts as well:

xlsfonts | grep ttf | more

Need more help on this topic? Click here
This article has 4 comments
Show me similar articles