Feeds

Fabulous fonts in Linux

It's easier than you think

  • alert
  • submit to reddit

Combat fraud and increase customer satisfaction

Howto One of the more common disappointments reported about the Linux GUI is clunky fonts under X. While it's true that they can look pretty rough out of the box, it's also true that sharpening them up is easy and well worth the effort, thanks to MS TrueType fonts and the open-source FreeType project which makes them useable on Linux. What follows is an explanation of how to tweak them, assuming KDE is your desktop manager. (I imagine this may work on other desktops, but KDE is the only one I'm well acquainted with.)

The first step is to download and install the MS TrueType core fonts. These used to be available from MS but are no longer, though they can be had now courtesy of SourceForge here, along with detailed instructions for downloading and installing them. You'll have to download a source RPM and then build a binary RPM. If you're a newbie and this sounds intimidating, there's a simpler alternative if you have an existing Windows image on your Linux machine: simply copy the desired fonts from the Windows partition to a directory on your Linux partition. My guess is that if you've paid MS for the privilege of using their fonts, you can use them with another OS so long as you don't distribute them without permission.

Now, merely having TTFs or anti-aliasing isn't enough. Take a look at this screen shot of TTFs in an OpenOffice.org document. They're clunky and blocky and basically impossible to distinguish from each other. However, with a bit of tweaking we can make them look distinct, slick and refined, as you can see in this screen shot.

The difference between the two is a feature in FreeType which is turned off by default. You may have anti-aliasing selected via the KDE Control Center, but unless you build the FreeType font engine with a trick I'm going to explain, this setting has little or no beneficial effect on TrueType fonts.

Due to licensing hassles, FreeType is distributed with some TTF support switched off. Thus we have to build FreeType so that this feature is available, a procedure which, fortunately, is quite easy. That's the only difference in the two screenies above -- the first was shot with FreeType in its default configuration, the second with FreeType tweaked in the manner that I'm about to describe.

First you need to download the FreeType source tarball and unpack it in a convenient directory, probably /root since some of what we have to do needs to be done as root anyway. Once it's unpacked you need to edit a file in the FreeType directory: go to freetype-2.x.x/include/freetype/config/ftoption.h and open it in a text editor. Now find the line in ftoption.h which reads
#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER and change it to
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER. Save your change.

Now bust out a shell and find out where FT should be installed with the command freetype-config --prefix. This will tell you where it's installed on your system, if you have it installed. Install the new version in the same directory with the prefix command. For example, assuming it's in /usr/local, you would start with the command ./configure --prefix=/usr/local and so on. If you don't have FT installed, it defaults to /usr which is fine. Now just run ./configure --yourprefix, then make, then make install and you're almost home.

There's a little issue with XF86 version 4 which makes it prudent to do the installation again in /usr/X11R6, following the steps above. When you upgrade FT, you'll have to install in both directories again.

All right, now you have your TTFs copied and your FreeType engine installed. Now it's time to make them available. Re-start X, and then open the KDE Control Center as root. Go to System, Font Installer. Click the tab 'Anti-Alias' and tick 'Use sub-pixel hinting'. Now click the 'Fonts' tab. On the left you'll find a tree designating the directory to install the TrueType fonts from. Select whatever directory you copied them into originally. On the right you'll find a tree designating the directory to install the fonts to, typically /usr/X11R6/lib/X11/fonts/truetype. Set the directories and then select all the TrueType fonts in the source directory and click on 'Install'. In a moment they should all show up in the destination directory. Now click 'Apply' and OK on any error messages you might get.

That's all there is to it. Re-start X again, and all your apps should be able to exploit the new fonts, except OpenOffice.org, which needs an extra step. You can open Krusader or Konqueror or Mozilla and in the fonts sections find the TTFs to be applied according to your choice. You can apply them to the KDE desktop with Control Center, Look & Feel, Fonts (make sure 'use anti-aliasing' is ticked), and Control Center, Look & Feel, Desktop. You can apply them to Kedit and Kmail and a score of other apps.

For OpenOffice.org you need to install the fonts again manually. Go to your OO.o directory and execute the file, spadmin. Go to Fonts, Add, and choose the source directory, /usr/X11R6/lib/X11/fonts/truetype. When the fonts are visible in the window, click on 'Select All' and then 'OK'. You'll then be given a choice of copying the fonts to your OO.o directory or linking to them. Either will work.

All right; you've done it. Below are screen shots illustrating how handsome KDE can be with TrueType fonts properly supported and configured. This is what I'm looking at; there's no reason why you shouldn't be too. ®

KDE Control
Krusader
Mozilla1
Mozilla2

Note, several readers have pointed out that this technique seems to break anti-aliasing. It does, but not universally. Some fonts will have it and some won't. However, merely disabling anti-aliasing definitely doesn't work as well as enabling the bytecode interpreter. Regardless of the side-effects, the result is a KDE desktop that's easy to look at, imho. --tcg

Caveats

Reader Simon Burns reports that installing FreeType from source on Red Hat 8 made his KDE desktop disappear. He fixed it by deleting libfreetype* from /usr/X11R6/lib and /usr/lib and installing the Red Hat FT RPMs.

Reader Adam Williamson believes that Mandrake users should avoid building the FT package from source. He says, "Mandrake users should not rebuild FreeType; they should simply use the FreeType RPMs from PLF - the Penguin Liberation Front - which are stock Mandrake RPMs, but rebuilt with the bytecode interpreter enabled. If you run Mandrake 9.0, the appropriate RPM is at: http://plf.wwwhost.biz/files/9.0/i586/freetype2-2.0.9-3plf.i586.rpm"

3 Big data security analytics techniques

More from The Register

next story
Ubuntu 14.04 LTS: Great changes, but sssh don't mention the...
Why HELLO Amazon! You weren't here last time
This time it's 'Personal': new Office 365 sub covers just two devices
Redmond also brings Office into Google's back yard
Next Windows obsolescence panic is 450 days from … NOW!
The clock is ticking louder for Windows Server 2003 R2 users
Half of Twitter's 'active users' are SILENT STALKERS
Nearly 50% have NEVER tweeted a word
OpenBSD founder wants to bin buggy OpenSSL library, launches fork
One Heartbleed vuln was too many for Theo de Raadt
Got Windows 8.1 Update yet? Get ready for YET ANOTHER ONE – rumor
Leaker claims big release due this fall as Microsoft herds us into the CLOUD
Batten down the hatches, Ubuntu 14.04 LTS due in TWO DAYS
Admins dab straining server brows in advance of Trusty Tahr's long-term support landing
Red Hat to ship RHEL 7 release candidate with a taste of container tech
Grab 'near-final' version of next Enterprise Linux next week
Apple inaugurates free OS X beta program for world+dog
Prerelease software now open to anyone, not just developers – as long as you keep quiet
prev story

Whitepapers

Mobile application security study
Download this report to see the alarming realities regarding the sheer number of applications vulnerable to attack, as well as the most common and easily addressable vulnerability errors.
3 Big data security analytics techniques
Applying these Big Data security analytics techniques can help you make your business safer by detecting attacks early, before significant damage is done.
The benefits of software based PBX
Why you should break free from your proprietary PBX and how to leverage your existing server hardware.
Securing web applications made simple and scalable
In this whitepaper learn how automated security testing can provide a simple and scalable way to protect your web applications.
Combat fraud and increase customer satisfaction
Based on their experience using HP ArcSight Enterprise Security Manager for IT security operations, Finansbank moved to HP ArcSight ESM for fraud management.