HOWTO: Using Anti-Aliased Fonts with Mozilla in Linux


These instructions are written for the Debian Woody distribution of Linux, but you should be able to apply them to other distribution without too much effort.


STEP 1: Install the true type font packages.

Using dselect, or your favorite Debian package tool, install the following packages:


STEP 2: Restart X


STEP 3: Check Mozilla for TrueType Support

Set an environment variable called NS_FONT_DEBUG to 400.

export NS_FONT_DEBUG=400

Now, run Mozilla. If it says "freetype not compiled in" then you are out of luck. You have to get a copy of Mozilla that has TrueType support. The newer versions of Mozilla should work.


STEP 4: Edit Mozilla Configuration Files

Become root. Now edit the /usr/local/mozilla/defaults/pref/unix.js file.

Change this:


// TrueType
pref("font.FreeType2.enable", false);
pref("font.freetype2.shared-library", "libfreetype.so.6");
// if libfreetype was built without hinting compiled in
// it is best to leave hinting off
pref("font.FreeType2.autohinted", false);
pref("font.FreeType2.unhinted", true);
// below a certian pixel size anti-aliased fonts produce poor results
pref("font.antialias.min",        10);
pref("font.embedded_bitmaps.max", 1000000);
pref("font.scale.tt_bitmap.dark_text.min", 64);
pref("font.scale.tt_bitmap.dark_text.gain", "0.8");
// sample prefs for TrueType font dirs
//pref("font.directory.truetype.1", "/u/sam/tt_font");
//pref("font.directory.truetype.2", "/u/sam/tt_font2");
//pref("font.directory.truetype.3", "/u/sam/tt_font3");


to:

// TrueType
pref("font.FreeType2.enable", true);
pref("font.freetype2.shared-library", "libfreetype.so.6");
// if libfreetype was built without hinting compiled in
// it is best to leave hinting off
pref("font.FreeType2.autohinted", false);
pref("font.FreeType2.unhinted", false);
// below a certian pixel size anti-aliased fonts produce poor results
pref("font.antialias.min",        10);
pref("font.embedded_bitmaps.max", 1000000);
pref("font.scale.tt_bitmap.dark_text.min", 64);
pref("font.scale.tt_bitmap.dark_text.gain", "0.2");
// sample prefs for TrueType font dirs
pref("font.directory.truetype.1", "/usr/X11R6/lib/X11/fonts/truetype");
pref("font.directory.truetype.2", "/usr/X11R6/lib/X11/fonts/TrueType");
//more font dirs go here


STEP 5: Restart Mozilla


STEP 6: Change Mozilla Font Settings

In Mozilla, edit the Appearance->Fonts preferences. True type fonts start with a capital letter.

Back
  Copyright (C) 2003  Adam P. Whitney