|
TrueType for XFree86 Mini-Howto |
|||
|
|
|||
OverviewThis mini-howto describes the steps I followed to use TrueType fonts in X Windows. If you want to get to the guts of this mini-howto, you skip the background section.
CreditsA big thank you goes out to all the people who emailed me with suggestions, comments! This page will slowly incorporate all your recommendations!
DisclaimerI cannot guarantee the accuracy or correctness of the information I present in this howto. What I describe here is basically a log of what I had to do to set up my system. I cannot be held responsible for any damage done to your systems, use this information at your own risk! That being said though, if you have questions, comments, or suggestions, please send me email at ying @ zippydesign dot com.
BackgroundI have always been unhappy with the quality and limited selection of the fonts in X. They are inferior when compared to what is availalbe in the TrueType font world. The handful of ugly fonts that came with XFree86 were pitiful compared to what I was use in Windows. Fortunately, some kind souls created the FreeType project and XFSFT patches. I won't go into details about what they are, visit their respective homepages if you are interested. My desktop dualboots Linux and Windows 98, and all my truetype fonts are stored in the Windows 98 partition. What I wanted to do was be able to use those fonts in X. I am running:
If your configuration differs, please make the appropriate changes to my examples.
What You NeedFirst of all let's gather all the necessary components. Since I'm using RedHat, I'll be using the RPM's to install everything. It is assumed that you already have X up and running. The versions of software I list below are the most current (as of this writing), I found them on rpmfind.net.
Special thanks to Jim Wadell and Stephan F. Stevens from the Alaska Linux User Group for providing a convenient place to grab all of the above files. You can download them from ftp.aklug.org/pub/contributions/TrueType.
InstallingThe nice thing about RPM's is that they are so easy to install. You have to be root to install RPM's, so once you're root and get to the directory where you downloaded these files to: $ rpm -Uvh freetype-1.2-i386.rpm $ rpm -Uvh freetype-devel-1.2-i386.rpm $ rpm -Uvh xfsft-1.0.3-1.i386.rpm You'll have to build ttmkfdir manually, so: $ mkdir ttmkfdir $ cd ttmkfdir $ tar -zxf ../ttmkfdir $ make FREETYPE_BASE=/usr You'll end up with a binary ttmkfdir, copy this to /usr/local/bin or wherever you like. You need it to make fonts.dir and fonts.scale files, more on this later.
Creating a Fonts DirectoryFirst we have to make directories for our TrueType fonts (ttf). Here's your first decision, do you want to use fonts from an existing Windows partition or not. Using Fonts from an Existing Windows PartitionIf you have a dualboot system and would like to use the fonts out of your Windows directory, then read on otherwise this part doesn't apply to you. I have my ttf's in my Windows partition, I mount this as /mnt/c, so my fonts are in /mnt/c/windows/fonts. I made a symlink called /usr/share/fonts/truetype that points my real ttf directory. $ mkdir /usr/share/fonts $ ln -s /mnt/c/windows/fonts /usr/share/fonts/truetype Installing New TTF FontsIf you don't have Windows on any other partition, or would like to keep the fonts separate, then just make this directory and fill it up with your favourite truetype fonts: $ mkdir /usr/share/fonts $ mkdir /usr/share/fonts/truetype
Setting up the Fonts DirectoryAfter you have your ttf's in the fonts directory, you have to build fonts.dir and fonts.scale files. If you're curious as to what they do, read up the documentation that comes with the xfsft package. Okay, now go into the ttf font directory and run ttmkfdir (the thing you built a while ago): $ cd /usr/share/fonts/truetype $ /usr/local/bin/ttmkfdir > fonts.scale $ mkfontdir ttmkfdir might complain about a couple fonts, read the docs to find out why. The mkfontdir program comes with XFree86, so if it's not in your path then you should find out where it is. It is also important to note that everytime you add a font to your system, you must run tmkfdir and mkfontdir again.
Configuring XFSFT and XF86ConfigW're almost done, there's just two files to edit, /usr/etc/xfsft.conf and /usr/X11/XF86Config. xfsft.confAdd the directory /usr/share/fonts/truetype and remove (or comment out) directories that you don't have for the catalogue directive. This is what mine looks like: clone-self = off
client-limit = 20
catalogue = /usr/X11R6/lib/X11/fonts/Type1,
/usr/X11R6/lib/X11/fonts/misc,
/usr/X11R6/lib/X11/fonts/Speedo,
/usr/X11R6/lib/X11/fonts/75dpi,
/usr/share/fonts/truetype,
# /usr/X11R6/lib/X11/fonts/100dpi
use-syslog = off
error-file = /var/log/xfsft-errors.log
default-point-size = 120
default-resolutions = 100,100,75,75
XF86ConfigXFSFT is able to render your other fonts as well as TrueType fonts. So if you already have a font path specified in your xfsft.conf, you don't need to specify it in your XF86Config. Just add a line telling X to look at the TrueType font server. Here is the relevent section from my XF86Config, the line in bold is what you have to add, and notice I commented out all my other font paths: FontPath "tcp/localhost:7100" #FontPath "/usr/X11R6/lib/X11/fonts/Type1" #FontPath "/usr/X11R6/lib/X11/fonts/Speedo" #FontPath "/usr/X11R6/lib/X11/fonts/75dpi" #FontPath "/usr/X11R6/lib/X11/fonts/100dpi"
That wraps up the configuration, let's start it up!
Starting the TrueType Font ServerIf you installed the RPM, just run: $ /etc/rc.d/init.d/xfsft start All this does is call /usr/X11R6/bin/xfsft -port 7100 -config /usr/etc/xfsft.conf so if you didn't install the RPM, put this in your rc.local or whatever. No error messages? Good, let's do the final step -- (re)starting X.
Starting XYou know how to start X, run startx. If you didn't see any error messages then voila, you've got your fonts! Go wild, load up Netscape and change the fonts to Times New Roman or Arial. Use Courier New instead of that gross thing you've been looking at for so long. Load up GIMP and play with all your new fonts!! If you don't want to restart X, just run: $ xset +fp tcp/localhost:7100 If you do this, be sure to restart the applications (like Netscape) to make the rebuild the font list. Enjoy!
Get More FontsIncase you don't already own a gazillion fonts, here are some places for you to pick up some freebies:
Known IssuesThe only problems I've run into so far are:
|
|||
|
|
|||
| Web Database Mini-Howto by Ying Zhang (ying @ zippydesign dot com) | |||