Netscape Fonts HOWTO ******************** Introduction ============ A quick and dirty way to get netscape fonts working correctly and limit crashes caused by scaling fonts using javascript. This approach has only been implemented on Linux using RH7.1 with Netscape 4.77 and XFree86 4.0.3. YMMV. Much of what exists here was ruthlessly plaugerized from Matjaz Rihtar. Give his page a visit http://www2.arnes.si/~mrihta3/ns-unix.html Version 4 of the X server and xfs can serve up true type fonts. That's great, except for the fact that Netscape cannot handle scaling fonts in javascript / style sheets and hangs, and if scaling is disabled all truetype fonts are only displayed with the default font size only. The solution described here involves taking a set of Windows truetype fonts converting them to pcf fonts and installing them. Confirm that the following utilities exist: ttf2bdf - can be retrieved from: http://crl.nmsu.edu/~mleisher/download.html. I copied this program to /usr/local/bin (make sure it is in the path). bdftopcf - Part of the XF86 distribution Getting the fonts ================= Don't tell a soul, the're stolen from any Windows machine. I used a dos shell on a windows box, went to the c:\Windows\Fonts or c:\WINNT\Fonts directory, ftp'd to my Linux box, logged in as a normal user, made a fonts directory on the linux box and dumped all the windows fonts into this directory. Converting the fonts ==================== Ensure a few 100Meg or so of disk space. For every truetype font, the following script creates 7 files for 7 font sizes for both 75dpi and 100dpi fonts. Depending on how many fonts, this step could take a few hours. Copy the following q&d script to the directory to where the fonts were copied on the linux box, and give it execute permissions. -------------------------------------- #!/bin/sh rm -rf 100dpi rm -rf 75dpi mkdir 100dpi mkdir 75dpi touch 100dpi/fonts.dir touch 75dpi/fonts.dir #echo "0" > 100dpi/fonts.dir #echo "0" > 75dpi/fonts.dir for f in `\ls *.ttf *.TTF | xargs` ; do fb=`echo $f | sed -e 's/\..*//'` echo "$fb" for dpi in "75" "100" ; do echo -n " ${dpi}:" for pt in "8" "10" "12" "14" "18" "24" "36" ; do echo -n " $pt" ttf2bdf -p $pt -r $dpi $f > ${dpi}dpi/${fb}${pt}.bdf n=`grep "FONT -" ${dpi}dpi/${fb}${pt}.bdf | sed -e 's/^FONT //'` bdftopcf ${dpi}dpi/${fb}${pt}.bdf | gzip > ${dpi}dpi/${fb}${pt}.pcf.gz echo "${fb}${pt}.pcf.gz $n" >> ${dpi}dpi/fonts.dir done echo "" done done rm -f 100dpi/*.bdf 75dpi/*.bdf n=`cat 100dpi/fonts.dir | wc | awk '{print $1}'` echo $n > 100dpi/fonts.dir1 cat 100dpi/fonts.dir >> 100dpi/fonts.dir1 mv -f 100dpi/fonts.dir1 100dpi/fonts.dir n=`cat 75dpi/fonts.dir | wc | awk '{print $1}'` echo $n > 75dpi/fonts.dir1 cat 75dpi/fonts.dir >> 75dpi/fonts.dir1 mv -f 75dpi/fonts.dir1 75dpi/fonts.dir -------------------------------------- Execute this program. Some time later (and I am not exagerating) it will have created two sub directories 100dpi and 75dpi, which are full of *.pcf.gz files. On my attempt some fonts did not convert, they caused ttf2bdf to core. I deleted those files from the directories. They were identified by uncharacteristicly small file sizes. I just deleted the offending TrueType files and reran the script. Installing the Fonts ==================== The following should be done as root. Create the following directory if it does not exist /usr/share/fonts/windows move the two newly created font directories 100dpi and 75dpi to be subdirectories of /usr/share/fonts/windows. Ensure all the files are chown root:root and chmod 644. Edit /etc/X11/fs/config adding the two directories near the top fo the cataloge section. My config looks like: ------------------------------ # # Default font server configuration file for Red Hat Linux # # allow a max of 10 clients to connect to this font server client-limit = 10 # when a font server reaches its limit, start up a new one clone-self = on # alternate font servers for clients to use #alternate-servers = foo:7101,bar:7102 # where to look for fonts # catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled, /usr/share/fonts/windows/75dpi:unscaled, /usr/share/fonts/windows/100dpi:unscaled, /usr/X11R6/lib/X11/fonts/75dpi:unscaled, /usr/X11R6/lib/X11/fonts/100dpi:unscaled, /usr/X11R6/lib/X11/fonts/misc, /usr/X11R6/lib/X11/fonts/Type1, /usr/X11R6/lib/X11/fonts/Speedo, /usr/X11R6/lib/X11/fonts/75dpi, /usr/X11R6/lib/X11/fonts/100dpi, /usr/share/fonts/default/Type1, /usr/share/fonts/default/TrueType, /usr/share/fonts/ja/TrueType, /usr/share/AbiSuite/fonts # in 12 points, decipoints default-point-size = 120 # 100 x 100 and 75 x 75 default-resolutions = 75,75,100,100 deferglyphs = all # how to log errors use-syslog = on # don't listen to TCP ports by default for security reasons no-listen = tcp ----------------------------------------- Also Ensure that X is configured to use the xfs server. Confirm that the statement 'FontPath "unix/:7100"' exists in the "Files" section of /etc/X11/XF86Config. ensure that the xfs daemon is installed and configured to start on reboot. chkconfig --level 345 xfs on /etc/rc.d/init.d/xfs restart Force more appropriate defaults for users ========================================= Create the following .Xdefaults file and copy it to every user's home directory, and put it in /etc/skel/ for future users. ------------------------------------ *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 *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 ! CSS-1 generic font family mapping ! to change the defaults, uncomment and give a different family name *documentFonts.generic.serif: times *documentFonts.generic.sans-serif: helvetica *documentFonts.generic.cursive: itc zapf chancery *documentFonts.generic.fantasy: new century schoolbook *documentFonts.generic.monospace: courier -------------------------------------- If your system is configured to start X automatically on boot, then you need to reboot to for the xfs configuration to carry through to X. Otherwise, to exit X, /etc/rc.d/init.d/xfs restart, and start x. Fireup Netscape, there should aready be a difference, but you are not quite finished yet. Netscape Preferences ==================== In the Appearance / Fonts dialog box disable "allow scaling" for both fixd and variable width fonts. Default fonts I like are: Encoding: Western Var Font Times Mew Roman (Monotype) Size 12 Fixed Font Fixed (Misc) Size 10 Check out the following pages courtesy of Matjaz Rihtar http://www2.arnes.si/~mrihta3/font-sizes.html http://www2.arnes.si/~mrihta3/font-faces.html QED - Hope it works for you, it did for me.