Friday, 3 September 2004

How to use windows fonts in Mozilla (linux)

In order to do that, you needed to copy the fonts you use for Windows XP Pro to Linux. Here are the steps to get fonts over to Linux and how to activated them:
1. If you don't have a /usr/share/fonts/TrueType directory, create one.
# mkdir /usr/share/fonts/TrueType
# cd /usr/share/fonts/TrueType

2. Make sure that all the font files you're copying have lower-case extensions, so if you have files like font.TTF, rename that to font.ttf
3. Copy the fonts to /usr/share/fonts/TrueType
4. Change into that directory:
# copy  /mnt/C:\/windows/fonts/*.ttf   /usr/share/fonts/TrueType/. # cd  /usr/share/fonts/TrueType 

5. Issue the following commands to build the necessary fonts.scale and fonts.dir:
# ttmkfdir -o fonts.scale
# mkfontdir

6. This should have now created the fonts.scale and fonts.dir files
7. Now go to you /etc/X11 directory so that you can add the new font directory to the search path of your X server by adding it to the fonts section of XF86Config

8. Edit XF86Config - Go to the "Files" section and add the FontPath there, mine looks like the following after editing:
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "unix/:7100"
FontPath "/usr/share/fonts/TrueType"

9. Now for the Mozilla part! Go to the directory you installed Mozilla in, located at /usr/local/mozilla. Change into /usr/lib/mozilla-1.4/defaults/pref. Note your mozilla may be installed somewhere else. In redhat, try
# rpm -ql mozilla grep unix.js 
to get the path where your unix.js file resides.
10. Backup the unix.js preference file so that you can get back to it if anything screws up:
11. cp unix.js unix.js.bak
12. Edit the unix.js file and look for the TrueType section and change it to look like the following snippet:

// 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", ;
pref("font.embedded_bitmaps.max", 1000000);
pref("font.scale.tt_bitmap.dark_text.min", 0);
pref("font.scale.tt_bitmap.dark_text.gain", "0.7");
// sample prefs for
TrueType font dirs
pref("font.directory.truetype.1",
"/usr/share/fonts/TrueType");
pref("font.directory.truetype.2", "/usr/X11R6/lib/X11/fonts/TTF");
//pref("font.directory.truetype.3",
"/u/sam/tt_font3");
pref("font.FreeType2.printing", true);

Now you'll enjoy a MUCH clearer veiw of websites you visit!

No comments:

Post a Comment