How to get proper fonts in Netscape on Linux/FreeBSD

This document describes steps how to get "proper" fonts in Netscape on Linux/FreeBSD using XFree86 X Window system. By "proper" it's meant modern Web fonts (mostly TrueType or Type1) in right sizes and encodings.

All examples in this document assumes default installations and directories, for example: XFree86 is installed on /usr/X11R6.

1. Install latest version of Netscape (4.7x)

You can get it on:

http://www.netscape.com/download/index.html

2. Modify Netscape.ad

Copy Netscape.ad from the directory where Netscape was installed, to /usr/X11R6/lib/X11/app-defaults/Netscape and modify it in the following way:

2.a) Select 100 DPI fonts before 75 DPI in font path (recommended):

*documentFonts.xResolution*iso-8859-1:    100
*documentFonts.yResolution*iso-8859-1:    100
*documentFonts.xResolution*iso-8859-2:    100
*documentFonts.yResolution*iso-8859-2:    100
*documentFonts.xResolution*windows-1250:  100
*documentFonts.yResolution*windows-1250:  100

2.b) You might also check other defaults:

*documentFonts.defaultFont*iso-8859-1.prop:     adobe-times-120-noscale
*documentFonts.defaultFont*iso-8859-1.fixed:    adobe-courier-100-noscale
*documentFonts.defaultFont*iso-8859-2.prop:     adobe-times-120-noscale
*documentFonts.defaultFont*iso-8859-2.fixed:    adobe-courier-100-noscale
*documentFonts.defaultFont*windows-1250.prop:   adobe-times-120-noscale
*documentFonts.defaultFont*windows-1250.fixed:  adobe-courier-100-noscale

! There are 7 font sizes, 1 thru 7.  The default font is 3, and the others
! are based on this.  The default increment is 20%, which means that the 4
! is 20% larger than the 3, the 5 is 40% larger, and so on.
!
*documentFonts.sizeIncrement:  20

! Maximum size to scale fonts, in points.
*documentFonts.maximumPoints:  240

3. Install X server with TrueType support

3.a) Install package Xfsft-1.1.7

This package contains X server XF86_???, font server xfs and modified mkfontdir utility, which is needed for different font encodings (replace original binaries). Included encoding files should also be placed somewhere reasonable (like /usr/X11R6/lib/X11/fonts/encodings).

Modified X server is based on XF86 3.3.5 distribution. You can get it on:

http://www.dcs.ed.ac.uk/home/jec/programs/xfsft/

3.b) Install utility ttmkfdir-0.0

This utility will be used to create fonts.scale/dir file for TrueType fonts. You can get it on:

http://www.joerg-pommnitz.de/TrueType/xfsft.html

3.c) Configure X server to use font server

This greatly adds to the response of the whole X system (default on newer RedHat distributions). Modify FontPath in /etc/XF86Config to include font server:
# default FontPath: misc, Speedo, Type1, 75dpi, 100dpi
#  FontPath   "/usr/X11R6/lib/X11/fonts/misc:unscaled"
#  FontPath   "/usr/X11R6/lib/X11/fonts/75local:unscaled"
#  FontPath   "/usr/X11R6/lib/X11/fonts/75dpi:unscaled"
#  FontPath   "/usr/X11R6/lib/X11/fonts/100local:unscaled"
#  FontPath   "/usr/X11R6/lib/X11/fonts/100dpi:unscaled"
#  FontPath   "/usr/X11R6/lib/X11/fonts/TrueType"
#  FontPath   "/usr/X11R6/lib/X11/fonts/Type1"
#  FontPath   "/usr/X11R6/lib/X11/fonts/Speedo"
#  FontPath   "/usr/X11R6/lib/X11/fonts/iso_8859.2/misc:unscaled"
#  FontPath   "/usr/X11R6/lib/X11/fonts/iso_8859.2/75dpi:unscaled"
#  FontPath   "/usr/X11R6/lib/X11/fonts/iso_8859.2/100dpi:unscaled"
   FontPath   "unix/:7100"
#  FontPath   "tcp/127.0.0.1:7100"
In this example only font server is in font path.

3.d) Configure font server

Modify catalogue in /usr/X11R6/lib/X11/fs/config to include all previous font paths from /etc/XF86Config:
# where to look for fonts
catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled,
  /usr/X11R6/lib/X11/fonts/75local:unscaled,
  /usr/X11R6/lib/X11/fonts/75dpi:unscaled,
  /usr/X11R6/lib/X11/fonts/100local:unscaled,
  /usr/X11R6/lib/X11/fonts/100dpi:unscaled,
  /usr/X11R6/lib/X11/fonts/TrueType,
  /usr/X11R6/lib/X11/fonts/Type1,
  /usr/X11R6/lib/X11/fonts/Speedo,
  /usr/X11R6/lib/X11/fonts/iso_8859.2/misc:unscaled,
  /usr/X11R6/lib/X11/fonts/iso_8859.2/75dpi:unscaled,
  /usr/X11R6/lib/X11/fonts/iso_8859.2/100dpi:unscaled

# mode for delayed fetching and caching of glyphs (none, all, 16)
deferglyphs = all

# in 12 points, decipoints
default-point-size = 120

# pairs of x and y resolutions in pixels per inch
default-resolutions = 75,75,100,100
As you can see, you can still use 75 DPI in front of 100 DPI, if you wish (some applications look better with 75 DPI fonts).

Important note: if there are no scalable fonts in FontPath (or if you use only the :unscaled attribute), Netscape may crash when using Java applets/scripts. Java needs scaled fonts!

3.e) Restart X server with font server

As X server needs running font server before X server starts (because of FontPath definition), you can either: It is recommended to use the proper -dpi size for your display, since font rasterization engine depends on it. Deferglyphs all also adds to the response speed (same as with xfs).

4. Install scalable TrueType/Type1 fonts

You should get at least the following fonts:

Arial, Verdana, Helvetica, Geneva, Times New Roman, Times, Swiss, Trebuchet MS, Courier New, Georgia, Futura, Tahoma, Courier, Arial Black, Palatino, StoneSans, Gill Sans, Chicago, Garamond, Univers, Comic Sans MS, Book Antiqua, Arial Narrow, Impact, Helvetica Black, ...

Fonts listed are the most commonly used on today's Web pages according to my Web scan (aprox. 40000 pages scanned). Of these fonts, the Arial/Helvetica family is used on over 65% of these pages.

You can find most of these fonts on the Web itself, for example on the Microsoft Typography page:

http://www.microsoft.com/typography/fontpack/default.htm

or you can get them directly from Windows 98/NT and/or after installations of MS Office, WordPerfect, Corel Draw, ...

It is recommended to get the latest versions of all fonts, because they'll include more encodings (iso8859-2, iso8859-15, fcd8859-15, ...). Of fonts not mentioned, Bitstream Cyberbit is especially recommended, since it includes almost all encodings you can imagine (even Chinese :-).

You'll have to extract *.ttf font files from distribution files and copy them to the proposed directory /usr/X11R6/lib/X11/fonts/TrueType.

4.a) Generate fonts.scale/dir file

You can create appropriate fonts.scale/dir file with hand or use the ttmkfdir utility, which automatically creates fonts.scale file in this directory. You should check this file and fix possible errors or remove encodings you don't want. I usually keep the following encodings: iso8859-1, iso8859-2, iso8859-15, windows-1250.

Note: If you use TrueType fonts with proper encodings, there's no need to have any additional bitmapped iso8859-2 (or other) fonts.

After the usage of mkfontdir file fonts.scale is simply copied to file fonts.dir.

You can also generate fonts.alias file here, if you want to map or replace other X11 fonts with TrueType fonts. For example:

-adobe-times-...         "-monotype-times new roman-..."
-adobe-courier-...       "-monotype-courier new-..."
-adobe-helvetica-...     -monotype-arial-...
-monotype-geneva-...     -monotype-arial-...
Some notes about fonts.alias file:
If there is a blank in font name, it should be included in quotes. You can alias scalable font using -0-0-0-0- for sizes. Example:
-adobe-times-medium-r-normal--0-0-0-0-p-0-iso8859-1  .  .  .
  .  .  .  "-monotype-times new roman-medium-r-normal--0-0-0-0-p-0-iso8859-1"
If you do replace other X11 fonts with TrueType fonts, you'll have to remove replaced X11 fonts from FontPath (delete lines from appropriate fonts.dir and fonts.alias files).

Important note about xlsfonts/xfontsel programs:

You can check the order (i.e. FontPath) of currently installed fonts with xlsfonts program. But it seems that at least on FreeBSD/XF86 3.3.5 xlsfonts doesn't show all installed fonts when used without parameters. xfontsel on the other hand shows all fonts. The difference is in wildcard pattern used in both programs:

You can check this by issuing the following commands and then compare the results:
xlsfonts -fn '-*-*-*-*-*-*-*-*-*-*-*-*-*-*' > output1
xlsfonts -fn '*' > output2
Pattern used in xfontsel (-*-*-*-*-*-*-*-*-*-*-*-*-*-*) seems to be the right one.

4.b) Generate predefined fixed sizes of TrueType/Type1 fonts

This step is necessary exclusively for Netscape (up to version 4.7x).

Netscape can't remember properties of scalable fonts after exit, even if you set them up in Preferences/Fonts (except for the current font). Default point size is that of font server (typically 12 points), which can be too large/small for some fonts and Allow scaling is disabled!

This of course makes scalable fonts unusable in Netscape, unless there are predefined fixed sized font files. You can generate these files:

After you get bdf files, convert them to pcf files with the utility bdftopcf (part of normal XF86 distribution) and compress them with gzip.

Fixed sized font files must be placed in directories before TrueType directory in FontPath, for example:

  ...
  /usr/X11R6/lib/X11/fonts/75local:unscaled,    # fixed sized TrueType fonts
  /usr/X11R6/lib/X11/fonts/75dpi:unscaled,
  /usr/X11R6/lib/X11/fonts/100local:unscaled,   # fixed sized TrueType fonts
  /usr/X11R6/lib/X11/fonts/100dpi:unscaled,
  /usr/X11R6/lib/X11/fonts/TrueType,            # scalable TrueType fonts
  ...
When Netscape discovers fixed sized font files, it determines default point size from available sizes. This algorithm works something like this:
default point size = round up of (largest size / 2)
Round up depends on how many sizes are actually available (below and above the default point size).

After some experimentation I recommend the following fixed sizes for some common Web fonts (* marks default point size):

Times New Roman, Futura bold/light  9, 10, (*12*), 15, 17, 20
Trebuchet MS                        8, 11, (*12*), 15, 17, 20
Arial                               8, 9, *11*, (12), 14, 16, 18
Arial Black, Futura bold/medium     8, 9, *11*, (12), 14, 15, 18
Verdana                             7, 9, *11*, (12), 14, 16, 18
Tahoma                              7, 9, *11*, (12), 14, 15, 18
Georgia                             7, 8, *11*, (12), 14, 16, 18
Courier New                         7, 8, *10*, (12), 14, 16, 18
Generation of fixed point size 12 is not necessary, since it'll be offered by font server anyway.

You should generate fixed sized font files for both 75 and 100 DPI. Point sizes used in 75 DPI shouldn't differ from the ones used in 100 DPI.

You should also generate fonts.alias files in both directories, like the one used in TrueType directory, but this time with fixed sizes. For example:

-adobe-times-medium-r-normal--10-100-75-75-p-40-iso8859-1  .  .  .
  .  .  .  "-monotype-times new roman-medium-r-normal--10-100-75-75-p-40-iso8859-1"
-adobe-times-medium-r-normal--12-120-75-75-p-52-iso8859-1  .  .  .
  .  .  .  "-monotype-times new roman-medium-r-normal--12-120-75-75-p-52-iso8859-1"

5. Enjoy proper fonts in Netscape

Each time you add new font(s) to the font database, you'll have to restart font server (and/or X server). If you still don't see the proper font, you should check font existence and position in FontPath with the utility like xlsfonts (unsorted listing).

After you install all available fonts, you can try some of the following test pages:

Microsoft CSS Gallery pages (move on to the next slides ...):
http://www.microsoft.com/typography/css/gallery/slide1.htm

All font sizes with sample text in [normal | bold | italic] and [proportional | monospace] combination:
font-sizes.html

All font faces with sample text in [normal | bold | italic] combination:
font-faces.html


Last modified: Aug 13, 2001 Copyright © 2000-2011 Matjaz Rihtar
Matjaz Rihtar <matjaz(at)eunet.si>