|
.comment: A Whole New Desktop with Anti-Aliasing
A Really Polished Look for LinuxI've spent a couple of days procrastinating, putting off writing this column. Not because it will contain unhappy news or will be particularly difficult to put together, but because I'll have to use StarOffice or WordPerfect or Applix Words, and during that time I'll have to look at screen fonts that aren't anti-aliased. As you have probably heard, Keith Packard's Xft extension, which had been available hacked into versions of QT since 2.2.3, took up permanent and official residence there with last week's release of QT-2.3.0. This means that if you build QT with the -xft compile option (or obtain a binary that has it compiled in), and you do a few more things I'll discuss in a moment, you'll have anti-aliased screen fonts. They are a joy. For those who are not familiar with the term, anti-aliasing is a sleight-of-hand in which the jagged edges of curved letters and numerals are rounded off, making them look more like real letters and less like letters made from Lego blocks. This is done by placing gray pixels in the places where the rounding ought to take place and would if our screens were made up of something other than pixels. The two magnified images here show the effects of anti-aliasing and the alternative (what? aliasing?) on similar but not identical typefaces. They'll give you a sense of what I'm talking about, anyway. The whole process is reminiscent of the "Resolution Enhancement" employed by H-P in their LaserJet III series, in which the size of the dots was varied, making an actual 300-dpi printer seem like a 600-dpi one. TrollTech's inclusion of support for the anti-aliasing extension in XFree86-4.02 and later, which is therefore made available to KDE-2.x users, represents a considerable step for Linux in my view. Windows and the Mac have long had this feature. It's the first time a full Linux desktop has offered it. (I feel compelled to note that there are some people who find that anti-aliasing makes letters look fuzzy. They don't like the effect. It can be turned off in Windows, and on the Mac, and, yes, in KDE. My bet is that most people who try it will never look back. Take a look at the other screenshots here, and you'll see what I mean.) So. How can you bring this marvel to your very own desktop?
My Embarrassingly Needless OrdealLet me say right off the bat that if your hardware is supported, as mine is, enabling screen font anti-aliasing is incredibly simple. I need to provide this anti-caveat because it was anything but simple for the four days I spent trying to get it to work here, which story I tell because otherwise the four days will have been entirely wasted, because it gives me the opportunity to thank some people who time after time go the extra mile to help users resolve problems, and because it is illustrative of the fact that software problems arise sometimes from completely unexpected places. When a hacked QT-2.2.3 that Keith Packard had put together was made available a couple of months ago, I took it for a spin. It was pretty enough, but my typeface selection dialogs had all become empty. My desktop comprised a sans serif proportional typeface, and a nondescript fixed one, and those were the choices. Others reported no problems. After hammering away at it for awhile, I decided that perhaps I was expecting too much. Meanwhile, the typefaces were not especially objectionable even if they would not have been my first choice, and anti-aliasing gave KDE such a delightfully polished appearance that I decided I'd live with them -- after all, this was just a hack, and one does have to expect certain inconveniences when dealing with software so developmental that the official KDE stance was that it would countenance no bug reports connected with anti-aliasing. So when QT-2.3.0 came out, and it was now official, I figured it would probably work just fine, and whatever gremlin had denied me my full range of typefaces had probably now been banished. I was wrong. I built the new QT. I fired up KDE. Same problem as before. Okay, I rebuilt KDE against the new QT. Shouldn't have been necessary, and as it turns out isn't (though there's one little advantage to doing so, which I'll get to). No joy. Recompiled the very newest XFree86 as reflected in that day's CVS tree. Nope. (By the way, doing so just about doubled the speed of the video here. It could be something specific to my video card, but if it's more general, XFree86-4.03 is going to be an enormous improvement.) Desperate, I gave in: I read the docs. The XFree documentation is a little odd. First, the good stuff lives off in the boonies: /usr/X11R6/lib/X11/doc. Second, there is one README[something].txt for every computer sold since the Altair. Third, the nearby HTML version contains none of the good stuff, which is in those text files. The fonts textfile seemed appropriate, so I consulted it. It said that I should set up the XFree font manager, xfs, which I did. (For purposes of brevity rather than to hide my stupidity, I'll leave out here how I set it up at one point such that my machine booted, launched xfs, and stopped there, and my panicked late-night phone call to Kurt Wall, who a.) wrote much of the Caldera eDesktop documentation and who b.) is in the phone book and is a friend and who c.) talked me through the fix.) Xfs was not the answer, even when the machine booted all the way to a prompt. I annoyed the good people on the KDE development and XFree86 mailing lists, and got lots of encouraging help. Malte Straostik from the KDE developers list stayed up very late Thursday night (I know it was late, because it was late here and he's in Germany) offering suggestions, code, and moral support in a series of rapid-fire emails. Lars Knoll of TrollTech offered help and even a HOW-TO that he put together (possibly partially in hope of shutting me up). Keith Packard explained the workings of the Xft configuration file, which at some point I had concluded (incorrectly) was the culprit. The community again proved that it is tremendously helpful if it thinks you're really trying, even if it also thinks you've maybe gone crazy because stuff that works everyplace else is not, you say, working for you. Late Friday, day three of my anguish, Matt Newell posted to the KDE developers list that there was a bug somewhere that caused KDE fonts not to be listed for him. He posted a patch to kdelibs that would fix it. I applied the patch and prepared to do a recompile, not at all certain that this had anything to do with the problem I was seeing. It was a very small change -- an edit rather than a patch per se -- and I, not a coder, did not see its significance. And having had at this with the frenzy that is experienced only by a computer user determined to make something work that doesn't want to, I was exhausted, and went to sleep. Saturday morning, there was a note
from David Faure. If I knew him, he'd be the brightest guy I know. My
impression is that he knows the KDE code the way Linus knows the
kernel, and that somewhere in his head he's established a virtual
computer that ticks through code. But more than that, he can explain
it! He now took note of Matt's discovery and said that the line in
question apparently pointed to a Because I have built KDE2 from the CVS
tree every week or two for a year and a half, and because going
around and reconfiguring everything is not much fun, I only made a
habit of keeping my "BINGO!!!! BINGO!!!! give the man a cigar! renaming this file, which appeared last june 15, solved *all* the a-a problems here!" David responded that the discovery had actually been Matt's and also that he, David, does not like cigars. So, I'd had about 85 hours of struggling with this problem, 84 hours, 59 minutes, and 45 seconds of which were wasted -- if I'd nuked that file, anti-aliasing would have worked from the beginning. I did not suspect that file. Hell, I didn't know I had that file. And I'd all but forgotten that I'd once had a kfontmanager. Actually, it wasn't a waste. I learned a lot, both about the workings of typefaces in XFree86 and about the brilliance and friendliness of the community. You have endured my tale of woe and, I hope, taken the acknowledgments seriously. Now let's move on to how you can make this thing work, including the 95 percent obvious stuff that anybody can figure out in five minutes and the 5 percent that got dribbled out over the rest of the time I was scrambling around.
Getting, Installing, and ConfiguringOkay, first, in case I forget it
later: If you are running KDE-2.x and you have a
Second, make sure that you're not wasting your time, which is to say make sure that your video card is supported. If you're not running XFree86-4.02, you ought to be anyway if your video card is supported. If you are running it, open a terminal emulator and do xdpyinfo, which will provide all kinds of obscure information about your video system. Scroll through it until you find a section headed "number of extensions:" followed by a number. The extensions you have available are listed, in alphabetical order. If RENDER is among them, you've passed the first test. (Here it can be a little complicated
if you've not built your XFree from source. If you compile it
yourself, you'll need to make sure your source tree's
This is the default location for
Freetype2. It is included in the XFree distribution, but must be
compiled separately. It's found in Presuming XFree-4.02 or better,
presuming the existence of Freetype2 on your machine, and presuming
the existence of libXft on your machine (all of which can be
confirmed by use of the Load "freetype" Now. If your distribution was
assembled by vicious morons, the FontPath lines will
list nothing but your font server, rather than the proper method of
including all the font directories, commented out. This would not be
an enormous concern but for one essential; if you do not have it,
then where you commented out the FontPath In a multitude of experiments with
anti-aliasing, I have not found a configuration that allows the
elimination of this. Fact is, there are numerous FontPath lines you
might want to leave. Here's the appropriate section from mine: This will see you through, because some
applications will want XFree86-provided typefaces that you might not
have in anti-aliased form. Feel free to copy and paste from the
above, with these caveats: If you don't actually have those
directories, they'll do you no good, and if you're not running at
high resolution, 1024x768 or above, you'll want to reverse the 100dpi
and 75dpi lines or your screen fonts may be bigger than you expect,
especially in non-KDE applications you run under KDE. You noticed, perhaps, that the
truetype and Type1 lines have been commented out in my example. This
is not a gift from the gods. You need to tell the system, elsewhere,
about their existence. You do this in a file whose fully qualified
name is (Keith Packard, who assumes the best of Linux users, has built in lots of
possibilities that will substitute anti-aliased fonts for the ones
demanded by non-KDE applications. His prototype XftConfig file, and
TrueType typefaces for those who lack them, does this, and it's
probably more self-explanatory to most people than it was to me; fact
is, you can probably just pop it in and live in happiness forever.
While I very much appreciate Keith's tremendous work, I fall back on
the likes of David Faure and Kurt Wall, who recognize that some of us
are dimwitted and allow for it.) Now it's time to get or build an
Xft-enabled QT-2.3.0. If you're building it, add -xft to the already
long Once you have QT-2.3.0 with the Xft
extensions, you're pretty much home free. If you didn't get your
KDE-2.1 -- you are running 2.1 if you're running KDE, right?
No? Well, get it! -- from Debian, or build it from source
against Xft-enabled QT-2.3.0, there's one thing more to do. It's an
environment variable, If, however, you got Ivan's binaries
or you built against QT-2.3.0, this isn't necessary. Once you start
KDE, go to the K menu > Preferences > Look & Feel >
Style. This will now contain a checkbox next to "Use
Anti-Aliasing for Fonts and Icons." Check it and restart KDE.
Anti-aliasing is yours!
As
I understand it, Gnome users will have anti-aliasing available by
year's end; my guess is that if it becomes as popular with others as
it is with me, it will be far before year's end. This is a
good thing in many respects, and a sad one in others.
For instance,
there are dandy but minimalist desktops such as XFCE that do not
bring applications with them. There is no way presently conceived
that these can extend anti-aliased screen fonts to all the
applications they launch. The independent development of X-based
applications, not tied to any desktop, may well suffer as a result.
This is not good; indeed, it leads to the kind of centralization that
many of us adopted Linux to escape. Related and
perhaps worse is the unhappy fact that anti-aliasing provides the
illusion that some kind of unified typeface handling exists when it
doesn't. It's a step, but it isn't the destination, yet it allows us
to think about something else for a little longer. We can't do it
forever.
|