The OpenNET Project / Index page

[  /+++ | | | ]


5. Adjusting Fonts in Specific Applications

5.1. Netscape

Note that Netscape 4.x should be considered obsolete these days. There are much better choices including Mozilla, Galeon and Konqueror. This section is being maintained for historical reasons; for those users who may have to use older Netscapes for one reason or another; and because it may have relevance to other applications.

Let's face it, Netscape is an important application in Linux. We all use it, and we all need it, so let's look at it specifically for a minute. An out of the box Netscape installation is prone to the font problems we've discussed -- large fonts that get pixelized, splotchy looking fonts, fonts so small they are unreadable. In short, ugly. Maybe this is why you are here?

Hopefully, at this point you have followed the above suggestions. These steps can help greatly. TrueType font availability is almost a necessity. Many web pages specify font families -- like Arial -- that are not typically available to Linux users. This is bad design, but having some of the basic TrueType fonts available will help greatly in overcoming the short-sightedness of some designers. Microsoft -- can't live with 'em, can't live without 'em.

Assuming you have TrueType working, from the Netscape menu select Edit -> Preferences -> Fonts. Open the Variable Width Font droplist on the right side of the window. Your TrueTypes should be there along with other fonts. Choose which ever one suits your fancy as the default. Check the Allow Scaling checkbox too. If the available point sizes are 0 and 12, you can go down and, and enter your desired point size in the box to the right and click on the OK button. The down-side to this is that Netscape will not remember these settings, and you will have to do this each time you start Netscape. Unless -- you have fonts.alias set up already. Then this will solve these problems. See Section 3.5 for more on fonts.alias.

You might consider experimenting with some ~/.Xdefaults (or perhaps it's~/.Xresources on your system) settings too:

 Netscape*DocumentFonts.sizeIncrement: 10
 Netscape*documentFonts.maximumPoints: 240
 Netscape*documentFonts.xResolution*iso-8859-1: 120
 Netscape*documentFonts.yResolution*iso-8859-1: 120

The 'sizeIncrement' controls how much of a jump Netscape makes when different 'basefont' sizes are specified ala:

<basefont size=7>

for instance. The default is '20', which is a pretty good jump. Changing this can help Netscape from scaling to too large and too small of a font. The x and y resolutions are roughly equivalent to 'dpi' settings. Any random number within reason can be used here. Experiment. Note: Mozilla does not use this kind of configuration!

Then run:

$ xrdb -merge ~/.Xdefaults

(or .Xresources as the case may be) and restart Netscape. There are many settings that can be tweaked or altered this way. Look at the (app defaults) file that should be included with Netscape packages.

If this approach does not get the job done as far as the 'tiny fonts' problem in Netscape, then see the fonts.alias section above. You can really fine tune many things with this approach.

5.2. Mozilla

Mozilla configuration should be roughly the same in many respects, but it does not use the Xresources type X configuration. You might find, however, that Mozilla does a much better job of handling fonts, and pages will look better overall. Highly recommended! The only caveat is, it seems to need a fairly fast system. It may be pretty sluggish on older hardware.

Also, some user preferences can be stored in "user.js" and "unix.js". Not to be confused with "prefs.js". user.js will likely have to be created by hand. Put it in whatever .mozilla sub-directory you find prefs.js in (this is not a consistent location, but typically ends like *.slt). Attempt to set a minimum font size:

 // Don't ever show me a font smaller than this: some samples.
 user_pref("font.min-size.variable.", 12);
 user_pref("font.min-size.variable.x-western", 12);
 user_pref("font.min-size.fixed.x-western", 12);


Other customizations can be made in userChrome.css and userContent.css. Again, both should be placed in the same directory as prefs.js. These files control much of the "UI" (the skin outside the browser window).

More info is available from the Mozilla developers:

It is also possbible to have anti-aliasing of fonts with Mozilla now. This might be a bit of work to get going at this time (Aug 2002), but it is possible. See the next section.

5.2.1. Mozilla with Xft

As mentioned above, the Xft extensions that give us anti-aliasing, and improved font handling, are slowly being rolled into Mozilla development. Such packages are often labeled as "TrueType" enabled. The reasoning being that they include native support for TrueType from within Mozilla. Note, that seems to be a bit of misnomer since properly installed TrueType fonts work quite well, even with ancient versions of Mozilla (though no anti-aliasing). The difference being that Mozilla does some of its own TrueType work.

There are many builds of Mozilla available, and it is not so easy to know which have Xft support. There are tips for knowing if your installed version does have this support, and then how to enable it here: Worse comes to worse, you can download experimental versions from:

For whatever reason, Mozilla has its own Xft configuration, that is independent of other system components. You must turn it on, and configure it (unless your vendor has done this already)! I know what you are saying, "one more place to configure fonts, sigh ...".

The above page explains rather tersely how to do this. The highlights:


XFree86 4.x with Xft support.
FreeType2 libraries.
Mozilla with Xft support.
TrueType fonts.


You will need to hand edit the relevant unix.js file, which is typically installed as /usr/lib/mozilla-*/defaults/pref/unix.js, or a similar location.

You will need to enable FreeType2 (and possibly define the version), and then list the directories that contain your TrueType fonts (each listing must be uniquely identified, see example). Sample excerpt:

 // TrueType ///////////////////////////////////////////
 pref("font.FreeType2.enable", true);
 pref("font.freetype2.shared-library", "");
 // if libfreetype was built without hinting compiled in
 // it is best to leave hinting off. try it both ways to see.
 pref("font.FreeType2.autohinted", true);
 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.8");
 // sample prefs for TrueType font dirs
 //pref("", "/u/sam/tt_font");
 //pref("", "/u/sam/other/tt_font");
 pref("", "/usr/share/fonts/truetype");

The // characters are comments. Then restart Mozilla. You should see it processing each font in the directories you specified (if started from the command line). You then need to go into the Mozilla font configuration (Edit -> Preferences -> Appearance -> Fonts), and select the appropriate fonts — these must be the ones that are listed with the first letter as upper cased:


This should now give you TrueType fonts with anti-aliasing! Quite nice!

You should experiment with the "hinting" preferences. Having hinting enabled made a significant improvement here.

Inferno Solutions
Hosting by

Created 1996-2024 by Maxim Chirkov
, ,