old-www/LDP/LG/issue28/ayers1.html

182 lines
8.4 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html> <head>
<title>True-Type Fonts for Linux</title>
</head>
<body bgcolor="#FFE7C7">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center><h1>The Xfstt True-Type Font Server</h1></center>
<center>
<h4>By <a href="mailto:layers@marktwain.net">Larry Ayers</a></h4>
</center>
<P> <hr><P>
<center><h3>Introduction</h3></center>
<p>After using Linux for some time I had developed a less-than-favorable
attitude towards TrueType fonts, partly because of their close association
with Microsoft products and partly because of the high-quality printed output
which Postscript fonts typically yield. I had become accustomed to the
poor-quality of the X windows screen display when using scaled (rather than
bit-mapped) PS fonts, only occasionally finding the un-aliased jagginess of
certain font sizes jarring. This is particularly noticeable in Netscape when
large fonts are displayed (titles, etc).
<p>It was with some bemusement that I read various announcements of TrueType
font-renderers and libraries for Linux in the past year. "Why", I wondered,
"are people expending so much energy developing TTF support for Linux when
Postscript fonts are supposed to be superior in so many ways?". I supposed
these packages were for people who had bought TrueType fonts and wanted them
available under Linux.
<p>Last month I was idly scanning messages posted to the XEmacs-beta mailing
list. I happened across a passing reference to the use of something called
xfstt to provide TrueType fonts for XEmacs. The writer of the message stated
that these fonts display well under X windows. This intrigued me, and later I
happened to be discussing various Linux matters with Chris Gonnerman, who runs
a small computer business in a nearby small town here in northern Missouri.
He showed me a Linux machine running a TT font-server, which piqued my
interest further.
<p>A few days later I saw an announcement posted on the
<a href="http://freshmeat.net">freshmeat</a> web-site stating that xfstt-0.9.8
had just been released. Something about a new release irrationally induces me
to try it out, so I got the package from
<a href="ftp://sunsite.unc.edu/pub/Linux/X11/fonts/Xfstt-0.9.8.tgz">Sunsite</a>
and compiled it.
<center><h3>Getting Xfstt to Work</h3></center>
<p>Xfstt is being developed by Herbert Duerr, and as far as I can tell it
seems to be a one-man project. The documentation is rather scanty, but the
FAQ file in the distribution provides enough information to get started.
Xfstt is a font server similar to X's native xfs. Once the server has been
compiled and installed, all that needs to be done is to populate the
directory&nbsp; <kbd>/usr/ttfonts</kbd>&nbsp; with *.ttf files (this directory
should have been created for you during the installation process), run
&nbsp;<kbd>xfstt -sync</kbd> (which lets the server know about the fonts),
then add the following line to your XF86Config file, near the end of the
font-path section:<br>
<p>&nbsp;&nbsp;<kbd>Fontpath "unix/:7100"</kbd>
<p>I'm guessing that the "path" above is actually the port at which xfstt
listens for font-requests from applications.
<p>Once these tasks have been completed, shut down X and execute the
backgrounded command &nbsp;<kbd>xfstt &</kbd>, wait a few seconds, then
restart X. The easiest way to try it out is to start Netscape, and in the
Options-&gt;General Preferences-&gt;Fonts dialog scroll through your installed
fonts and select one with (Ttf) appended to the font-name. Netscape showcases
xfstt's capabilities due to the variety of font-sizes in many web-pages. The
larger fonts in particular are much improved, without the jagginess they
usually exhibit.
<p>A little experimentation is needed to determine which of your applications
can make use of these fonts. The Gimp will use them, but it already does a
good job smoothing Postscript fonts, and I didn't see any great improvement
using TrueType fonts. XEmacs will display scalable fonts, but I'd never used
it for long with Postscript fonts due to X-induced scaling and rendering
problems. The new TT fonts will be available from the Options menu and the
improvement is remarkable.
<p>Another use for this font server is as a supplier of window-manager title
and menu fonts. A well-chosen font can really enhance the appearance of a
desktop; I've tried this with fvwm2 and icewm, and I'm sure it would work with
others. Lines such as these:<br>
<p><pre>MenuStyle gold darkslateblue bisque3 -ttf-americana-bold-r-*-*-12-*-*-*-*-*-*-* mwm
WindowFont&nbsp;&nbsp;&nbsp;-ttf-americana-bold-r-*-*-14-*-*-*-*-*-*-*
</pre><br>
<p>(for fvwm2)should work. The <em>-ttf-</em> prefix of the font-specifier is
the usual location of the font foundry name, such as Adobe or Bitstream.
<p>According to the xfstt FAQ the StarOffice suite, the Xcoral editor, and
Java can use these fonts, but I haven't tried them. The distribution includes
a sample <kbd>font.properties</kbd> file for use with Java.
<center><h3>Possible Problems</h3></center>
<p>The xfstt FAQ lists several problems people have had, mostly due to
misconfiguration. The only one I've seen is not serious, but deserves
mention. Once your XF86Config file has been modified (with the new Fontpath
added) the xfstt server will need to be running first before X is started. If
it's not running, X will fail to start, generating one of those classicly
cryptic error messages X is so fond of:<br><pre>
&nbsp;&nbsp;<kbd>_FontTransSocketUNIXConnect: Can't connect: errno = 111</kbd>
&nbsp;&nbsp;<kbd>_X11TransSocketUNIXConnect: Can't connect: errno = 111</kbd>
</pre>
<p>Either xfstt will have to be started from the rc.init scripts (and thus
be running constantly) or it can be manually started just before starting an
X session. A shell script or alias could also be used to first start xfstt
followed by X.
<center><h3>Other Implementations</h3></center>
<p>Xfstt isn't the only way to use TT fonts in a Linux X session. Another
project consists of a series of patches to the XFree86 source which will
enable X's native font-server to provide TT fonts. Confusingly, the name of
the project is <em>xfsft</em>. The home page of this effort is a good
central site for other information on the web concerning TrueType fonts and
Linux. It can be accessed
<a href="http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/">here</a>. A link
on the page will take you to the FTP site where the patches can be found.
The site also contains links to screen-shots of Netscape displaying TT fonts.
<p>The <em>Freetype</em> project is yet another approach. It isn't an
end-user application or server, but a library intended for use by programmers
desiring to embed TT support in their applications; the project home-page is
<a href="http://www.physiol.med.tu-muenchen.de/~robert/freetype.htm">here</a>.
<center><h3>Conclusions</h3></center>
<p>According to Herbert Duerr (in the FAQ) TT fonts are particularly suited
for display on low-resolution devices such as a computer monitor. Even though
xfstt doesn't do any anti-aliasing of the fonts (since there's no support for
this in X) nonetheless the fonts are displayed very clearly in all sizes.
Unix traditionalists will stick with their tried-and-true fixed-width fonts,
but users familiar with the font display properties of the various mswindows
OS's might want to give xfstt a try. It sure works well for me!
<hr>
<!-- hhmts start -->
Last modified: Wed 29 Apr 1998
<!-- hhmts end -->
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1998, Larry Ayers <BR>
Published in Issue 28 of <i>Linux Gazette</i>, May 1998</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./celestino.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./ayers2.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->