Optimal Use of Fonts on Linux

Avi Alkalay

Linux, Open Standards consultant :: IT and Software Architect
IBM Linux Impact Team :: ibm.com/linux
<avi unix sh>

Donovan Rebbechi

<elflord panix com>

Hal Burgiss

<hal foobox net>

Copyright © 2006 Avi Alkalay, Donovan Rebbechi, Hal Burgiss

2007-02-08

Revision History
Revision 2007-02-08 08 Feb 2007 avi
Fixed some typos, updated Luc's page URL, added DejaVu sections, added link to FC6 Freetype RPMs, added link to Debian MS Core fonts, and added reference to the gnome-font-properties command.
Revision 2006-07-02 02 Jul 2006 avi
Included link to Debian FreeType BCI package, improved the glossary with Latin1 descriptions, more clear links on the webcore fonts section, instructions on how to rebuild source RPM packages in the BCI appendix, updated the freetype recompilation appendix to cover new versions of the lib, authorship section reorganized.
Revision 2006-04-02 02 Apr 2006 avi
Included link to FC5 Freetype.bci contribution by Cody DeHaan.
Revision 2006-03-25 25 Mar 2006 avi
Updated link to BCI Freetype RPMs to be more distro version specific.
Revision 2005-07-19 19 May 2005 avi
Renamed Microsoft Fonts to Webcore Fonts, and links updated.
Revision 2005-05-25 25 May 2005 avi
Comment related to web pages in the Microsoft Fonts section
Revision 2005-05-10 10 May 2005 avi
Old section-based glossary converted to real DocBook glossary.
Revision 2005-03-31 31 Mar 2005 avi
Desktop configuration guidelines improved for higher resolution screens.
Revision 2005-02-18 18 Feb 2005 avi
Included BCI support status for Mandrake and Gentoo.
Revision 2005-01-12 12 Jan 2005 avi
E-mail addresses more difficult to figure out for machines.
Revision 2004-12-24 24 Dec 2004 avi
Small corrections and DocBook improvements.
Revision 2004-12-12 12 Dec 2004 avi
Typos correction by Scott Brayban (sgrayban borgnet us).
Revision 2004-12-05 5 Dec 2004 avi
Merged with FDU-HOWTO.
Revision 2004-11-27 27 Nov 2004 avi
Created first sections.

1. Introduction
2. Why Fonts on Linux Aren't Straight Forward ?
2.1. X.org Font Subsystems
3. The Easy Steps to Enlighten Your Desktop
3.1. Get a Better FreeType RPM
3.2. Configure Your Desktop
4. Font Packages
4.1. Bitstream Vera Fonts
4.2. DejaVu Fonts
4.3. Webcore Fonts
5. Producing Portable Documents
5.1. Linux to Windows and vice-versa
5.2. Linux to Linux
5.3. Any to Any with OpenOffice.org and Bitstream Vera Fonts
5.4. A Very Small Guide of Style
6. Create RPMs of Your Fonts
6.1. Step 1: Prepare Your Environment to Build The Package
6.2. Step 2: Prepare the Fonts Files to Package
6.3. Step 3: Create a .spec File With This Template
6.4. Step 4: Build It
7. Designer's Guide for Modern Good Looking Documents
7.1. Families of Typefaces
7.2. Classifications of Typefaces
7.3. Ligatures, Small caps fonts and expert fonts
7.4. Font Metrics and Shapes
8. Font Technologies
8.1. Bitmap Fonts
8.2. TrueType Fonts
8.3. Type 1 Fonts
8.4. Type3 Fonts
8.5. Type 42 Fonts
8.6. Type 1 vs TrueType -- a comparison
9. Getting Fonts For Linux
9.1. True Type
9.2. Type 1 Fonts and Metafont
10. Useful Font Software for Linux
11. Ethics and Licensing Issues Related to Type
12. References
12.1. Font Information
12.2. Postscript and Printing Information
Glossary
1. Recompiling FreeType for BCI
2. Recompiling an RPM Ready for Your Distribution
3. We Need Your Help
4. About this Document

1. Introduction

You can have the coolest desktop widget theme, the most enlightened colors combination, and a very nice background wallpaper. Your desktop still won't look professional, clean, beautiful, and most important, comfortable, without good fonts.

It is a common sense nowadays that good fonts are a key element for good desktop usability, because we use to spend hours per day in front of computers, writing documents, dealing with huge spreadsheets, making presentations, browsing and chatting. So we are all the day reading text.

The font subsystem on Linux evolved a lot in the last years, from an old naming, handling and option of fonts, to the support of True Type, Bistream Vera, etc. As of release time of Fedora Core 2, components like Xft, FreeType and FontConfig, and higher level software usage of them has stabilized and is now considered mature. But Linux still has issues with optimal font rendering, most of them related to software patents that we describe in Section 2, “Why Fonts on Linux Aren't Straight Forward ?” below.

2. Why Fonts on Linux Aren't Straight Forward ?

Jump to Section 3, “The Easy Steps to Enlighten Your Desktop” if you just want to fix your desktop fonts fast. Read this section if you are interested in the details on how and why make it.

Fonts are used on the screen and for printing. These medias differ a lot in DPI resolution: screens have 72 to 96 DPI, while modern printers use to have 300 DPI. So low-resolution medias as the screen need better font rendering algorithms to workaround the media's limitations.

To get optimal fonts on the screen you need:

  1. Good fonts designed for low resolution media.

    True Type font technology evolved to be the best thing you can get nowadays. But for optimal screen beauty, you also need fonts that were designed for this purpose. We found that Tahoma and Verdana are the best fonts you can get for the screen.

  2. A good font renderer.

    Current Linux distributions include the excelent and very mature FreeType font renderer library.

A .ttf file contains information to draw the characters at any size, so you eventually can convert a text into a scalable outline drawing (built from line segments and quadratic bezier arcs) with tools like OpenOffice.org or CorelDraw.

Font drawing algorithms are extremely complex because they have to decide which pixels to highlight based on the mathematical equations inside the .ttf file. When you need text in big sizes like 48 or 60, one or two pixels these algorithms "forget" to highlight doesn't make much difference, but when you need text at size 8pt or 11px, each pixel counts. And these use to be the text size for KDE and Gnome widgets, text for web browsing, and almost everything else we see on the screen.

To solve this problem more efficiently, beside of the mathematical equations inside a .ttf file, a font designer (a human being with a font creation software) also put some extra information to help the font renderer make correct decisions for this small size text. This process is called grid-fitting or hinting.

The point is: the technologies to interpret this hinting information are patented by Apple, and they are commonly called True Type Byte Code Interpreters (or simply BCI in our document, from now on).

With reverse engineering, the Freetype Project has implemented a byte code interpreter, but due to legal issues in some countries, some Linux distributions disable it at compilation and packaging time. This is a list of distributions that are known to enable or disable BCI. Please send us updates.

Table 1. FreeType Bytecode Interpreter Status per Distribution

Support No Native Support
Conectiva Mandrake
Gentoo Red Hat, Fedora

FreeType tries to workaround this legal issues developing autohinting algorithms, but in our tests, BCI algorithms gave us much better font rendering results on the screen.

2.1. X.org Font Subsystems

At the present time, X.org and XFree86 use two font subsystems, each with different characteristics:

  1. The original (15+ year old) subsystem is referred to as the "core X font subsystem". Fonts rendered by this subsystem are not anti-aliased, are handled by the X server, and have names like:

    -misc-fixed-medium-r-normal--10-100-75-75-c-60-iso8859-1

  2. The newer font subsystem is known as "fontconfig", and allows applications direct access to the font files. Fontconfig is often used along with the Xft library, which allows applications to render fontconfig fonts to the screen with antialiasing. Fontconfig uses more human-friendly names like:

    Luxi Sans-10

Over time, fontconfig/Xft will replace the core X font subsystem. At the present time, applications using the Qt 3 or GTK 2 toolkits (which would include KDE and GNOME applications) use the fontconfig and Xft font subsystem; most everything else uses the core X fonts.

In the future, Linux distributions may support only fontconfig/Xft in place of the XFS font server as the default local font access method.

spacer Note
An exception to the font subsystem usage outlined above is OpenOffice.org (which uses its own font rendering technology).

3. The Easy Steps to Enlighten Your Desktop

You'll have to:

  1. Update the FreeType library package on your system with one compiled with BCI support.

  2. Install the Webcore Fonts package (a.k.a. Microsoft fonts).

  3. Follow the instructions below on how to configure your desktop and common applications.

3.1. Get a Better FreeType RPM

FreeType compiled with BCI presented much better screen font rendering results.

Get RPMs for your distribution here:

  • Fedora 6 RPMs.

  • Fedora 5 RPMs by Cody DeHaan.

  • CentoOS or Red Hat Enterprise Linux 3 and 4, and Fedora 3 and 4 RPMs.

  • Mandrake RPMs through the Penguin Liberation Front website. The package name is libfreetype6.

  • Debian Sarge users have the BCI enabled FreeType from the "testing" and "unstable" package repositories. Next stable Debian version will include it as their default. The Debian package name is libfreetype6.

If you use one of these distributions, but on a platform that binary RPMs are not being provided, you can easily compile your own (even if you don't have any software compilation skills) following the instructions on Appendix 2, Recompiling an RPM Ready for Your Distribution.

WE WILL ACCEPT CONTRIBUTIONS of distribution specific FreeType repackaging, so if you can contact us, we appreciate.

If you are interested in repackaging your own FreeType, see how we repackage the Fedora Core and Red Hat RPMs with BCI on the Appendix 1, Recompiling FreeType for BCI as a reference.

3.2. Configure Your Desktop

General Guidelines

The main idea is to use good hinted fonts all around. As a general rule, we'll use Tahoma 8pt for desktop widgets, LucidaTypewriter 8pt for monospace text, and Verdana 8pt, 9pt or 10pt for fluent text reading or web surfing. These are the default font sizes on a Microsoft Windows desktop, and they look good on a 1024x768 screen. If you have a better screen resolution (1280x1024, 1600x1200) our suggestion is to stick with these fonts but increase their sizes.

We choose these fonts, specially Microsoft's Tahoma and Verdana, because they look perfect at small sizes (8pt, due to their excellent hinting), providing a more efficient screen utilization. They'll make your desktop look beautiful, professional, clean and comfortable. These fonts were designed for this purpose.

For window titles or text that will appear in bigger sizes, you may choose whatever you want because bigger sizes hinting are not so relevant.

3.2.1. A Note About Anti-Aliasing

Anti-Aliasing is a technique used to reduce the "steeper" effect on low-resolution medias, so it can be used to improve the quality of text on the screen. It is also used to blur the imperfections of bad hinted fonts at small sizes. For desktop widgets (usually with small size), some people think it makes the desktop look dirty.

So a practical conclusion we found is to use Anti-Aliasing for sizes bigger than 10pt, and use good hinted fonts for smaller sizes without Anti-Aliasing. Currently the best hinted fonts you can find, as we cited before, are the ones found in the Webcore font package.

3.2.2. KDE

To configure KDE, use the Control Center (kcontrol in the command line). This is how I have it configured.

spacer

Figure 1. General KDE font configuration

So we basically chose Trebuchet 12pt as the window title font, the bitmap font LucidaTypewriter 8pt for fixed size text, and Tahoma 8pt for everything else, which includes menus, buttons, etc. The 2 first should follow your taste, but Tahoma 8pt for all the rest is the optimal configuration, also used by MS Windows 2000 and XP.

One other thing to note is that I disabled anti-aliasing for font sizes up to 9 points. Look at the entire dialog and see how all text is clearly rendered, looks clean precise and professional.

Konqueror (KDE's browser and file manager) also needs font configuration for beautiful web browsing and file management.

spacer

Figure 2. Konqueror File Management font configuration

We used the same Tahoma 8pt for rendering the list of files in Konqueror's window, because Tahoma was simply designed with this purpose in mind, with 8pt being its most important size, with no need of anti-aliasing to be clear and beautiful.

spacer

Figure 3. Konqueror Web Browsing font configuration

And this is finally for web browsing. We are using Verdana as the general font because it was simply designed for the purpose of fluent text reading on the screen. And the old LucidaTypewriter when a web page requested a fixed size font. Some may choose fonts like Courier or Bistream Vera Mono here.

We left all other fonts blank, to let the page choose it. But you may use Times New Roman as the Serif Font. Read more about serif fonts in Section 7.2.2, “To serif or not to serif ?”.

The sizes of the fonts for browsing are a bit personal and depends on how healthy are your eyes, and the resolution of your screen. In my 1024x768 screen I use default size as 8pt, and I don't want web pages to use sizes smaller than 7pt. In the end of the day, to set the size is not so effective because modern web pages use to set them with absolute values. So it is more practical to use the browsers View menu to "zoom" the page you are currently seeing.

One more thing to note is the Default Encoding. This is a quite complex subject that deserves an entire HOWTO, but it is generally OK to leave it as the Language Encoding. You may need to change it if you frequently browse pages with non pure ASCII (international text) made by irresponsible webmasters that still don't use UTF-8 for the web. But here also it may be more practical to use the View menu to set the encoding for the current page you are browsing.

3.2.3. Gnome

We'll use our generic rules here too: Tahoma 8pt for everything. Navigate preferences menu to invoke the following dialog or just run gnome-font-properties from the command line.

spacer

Figure 4. Gnome Font Configurations

3.2.4. OpenOffice.org

As of Fedora Core 3 time, OpenOffice.org 1.1.2 has look (but not feel) integration with KDE and Gnome. This means that your environment should tell OOo how to use widget fonts. But we found it didn't really work. With further investigation we found that only the non-AA configuration we made was not propagated to OOo. So we used OOo's own dialogs to change it.

spacer

Figure 5. OpenOffice.org font configuration, using my KDE themes etc.

So we basically selected Tool, Options menu, and in the View section we enable OOo to do anti-aliasing at font sizes beginning with 12 pixels (approximately 9pt), and the result is what you can see above: clean and comfortable widgets with Tahoma 8pt.

3.2.5. Mozilla Firefox

Mozilla Firefox follows the same Konqueror rules.

spacer

Figure 6. Firefox fonts for web browsing

So we Edit->Preferences and then Fonts & Colors , and selected Verdana 14px for general browsing and LucidaTypewriter 11px for monospace text.

Firefox is a Gnome application, so it will use Gnome's font settings for widgets.

Additionaly, a very interesting way to configure some font rendering aspects of Firefox is described in a Mandrake Wiki.

3.2.6. Beautiful Alternatives Without Webcore Fonts

If you want to stay away from patents and proprietary fonts, the best way to go is with Bitstream Vera Sans 8pt, Nimbus Sans 8 or 9pt, or Luxi Sans 8 or 9pt (also known as Sans, simply) for desktop widgets, and bigger sizes for fluent text reading. You'll need Anti-Aliasing to blur the low quality of the hinting of these fonts.

Here are some screen shots about the usage of these fonts on KDE. You should pay attention on how the widgets text on this window are rendered.

spacer

Figure 7. Bitstream Vera 8pt with Anti-Aliasing

spacer

Figure 8. Luxi 8pt with Anti-Aliasing

spacer

Figure 9. Luxi 9pt with Anti-Aliasing

spacer

Figure 10. Nimbus 9pt with Anti-Aliasing

As you can see, the results aren't so good as Tahoma 8pt.

4. Font Packages

4.1. Bitstream Vera Fonts

Bitstream donated to the open world their Vera set of fonts, which are good quality and include a sans, sans serif and monospace fonts. This fonts are not very well hinted but can be used for desktop widgets, programming, fluent text reading and web surfing. Here is a screen shot:

spacer

Figure 11. Bitstream Vera Fonts

At these sizes, these fonts look great, specially with anti-aliasing. But unfortunately their bad hinting can be noted at small sizes.

Bitstream Vera fonts are included by default in all modern Linux distributions.

4.2. DejaVu Fonts

The DejaVu fonts are modifications of the Bitstream Vera fonts designed to extend this original for greater coverage of Unicode. It is being included by default in all modern Linux distributions, and everywhere you were thinking to use Bitstream Vera, DejaVu is another option with a more complete Unicode set.

spacer

Figure 12. The DejaVu Fonts

4.3. Webcore Fonts

The official distribution of these fonts for Linux include tarballs and RPMs for several distributions.

Also known as the Microsoft fonts, these are the best fonts available to be used on the screen. Very well hinted for small sizes makes them perfect for desktop widgets, fluent text, etc.

They are Verdana, Tahoma, Times New Roman, Arial, Trebuchet, Comic Sans, Impact and others. Here is a screen shot of them:

spacer

Figure 13. The Webcore Fonts

As we said before, Tahoma and Verdana were designed for the screen, but they are getting overused for many other purpose.

Our objective here is to provide links where you can get good quality RPMs, debs, etc for your distribution. These packages are provided by independent contributors, so if you have the skills to build them for your distribution, please contact us and send the URL for your packages. WE WILL ACCEPT CONTRIBUTIONS.

Packages for distributions:

  • Red Hat and Fedora RPMs. This is the orignal package, and it is reported to work in many other distributions.

  • Mandrake signed RPMs by Borgnet (Scott Grayban).

  • Debian Sarge (currently stable) and Etch (soon to be stable) both contain a package called msttcorefonts which contains the MS core fonts. Most Debian users running a GUI will probably install it.

  • Please send us more, such as Slackware and Debian packages.

After installing this font package you'll also note a better rendering of web pages, because professional web designers use to use them for their pages.

Some people say these fonts are free only for persons who have a Microsoft Windows license.

5. Producing Portable Documents

Yes, we know you had created rich documents, presentations, spreadsheets and web pages that looked great in your computer, but when opened in your friend's machine they looked completely unformated. So lets discuss here some good practices we found to avoid these annoying drawbacks.

5.1. Linux to Windows and vice-versa

If you need to exchange documents with Windows users, you should use Windows fonts. This is the general rule. So you should install the Webcore Fonts package and take care to use only Arial, Times New Roman, Verdana, etc, on your docs.

The combination of these fonts with the cross-platform, high quality OpenOffice.org suite, gives you a truly productive teamwork tool.

5.2. Linux to Linux

The fonts available on modern Linux distributions, to produce good quality documents are the following:

Table 2

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.