I like having anti-aliased fonts in mozilla. The easiest way to get that is to install gdkxft.
Installing gdkxft is a lot of work, but I think it's worth it. Judge for yourself: before and after. Also I have some other screenshots, near the bottom, showing gdkxft in action on some of my other computers.
To get the full benefit, you have to patch mozilla.
WARNING: with gdkxft installed, I've never been able to get evolution to work. (Actually it runs fine, but it has a font issue so you can't see any of the text in any of the evolution windows. which makes it kind of hard to read email.) Since I use Mutt and occasionally kmail this isn't a problem for me.
I emerged some extra font packages and put them in my /etc/X11/XF86Config-4 file. The extra font packages I emerged are app-text/freefonts-0.10-r1.ebuild, app-text/sharefonts-0.10-r1.ebuild, x11-misc/lfpfonts-fix-0.82.ebuild, and x11-misc/lfpfonts-var-0.83.ebuild.
Download the gdkxft tarball, gdkxft-1.5.tar.gz, and the mozilla patch, gdkxft-mozilla-patch-0.9.8.diff. Extract the tarball to /tmp, cd /tmp/gdkxft-1.5, and let the games begin.
First it wouldn't compile for me. After some fiddling with my CFLAGS environment variable, I finally got it to compile. Here's the CFLAGS I used:
"-O2 -pipe -mmultiple -mstring -I/usr/include/libcapplet1"
it couldn't find a header file until I added the -I at the end. Once you set your CFLAGS, you can do the usual "./configure && make && su -c 'make install'"
Now you have to get gdkxft to rebuild your /etc/X11/XftConfig file. Make a backup of /etc/X11/XftConfig. The README tells you to just run src/gdkxft_sysinstall but that won't actually do anything. You have to hack the script to get it to actually build you a new XftConfig file. Just delete line 370. Then run it as root.
As root, you need to fix some permissions. Do this:
chmod go+r /etc/X11/XftConfig
find /usr/share/themes -type f -print0 |xargs -0 chmod go+r
find /usr/share/themes -type d -print0 |xargs -0 chmod go+rx
Next you need to configure your user account to use gdkxft. As your regular user, back up your .gtkrc file. Then copy the one from /usr/share/themes/Gdkxft/gtk/ to ~/.gtkrc. Now you can tweak it to include your regular gtk theme at the beginning. But don't change any of the other lines.
Here's the scary part. Remember I said you're configuring your regular user right?? If you do this as root and gdkxft doesn't work for you, you will not be happy. Set an environment variable called LD_PRELOAD to the value "/usr/local/lib/libgdkxft.so". Then try running "ls". if you get a file listing, all is well. If you get some nasty error and ls won't run you can just quit the shell and all will be back to normal.
If ls runs though, try running gnumeric or any other gtk-1.2 app. You should be impressed. And if it works, you can put the LD_PRELOAD in your startup files. You really shouldn't ever set it up at all for root though.
But now on to the main goal: patching mozilla.
As root:
cd /usr/portage/net-www/mozilla
ebuild ./mozilla-1.0.1-r3.ebuild fetch unpack
pushd /var/tmp/portage/mozilla-1.0.1-r3/work/mozilla
At this point, portage has set you up a nice mozilla source tree. You need to patch it for gdkxft. For example, if you downloaded the mozilla patch to /tmp, you would type this:
patch -p1 < /tmp/gdkxft-mozilla-patch-0.9.8.diff
You'll note that the first hunk failed. it's ok, just edit gfx/src/gtk/nsRenderingContextGTK.cpp, go to line 2055, and insert these two lines as lines 2056 and 2057:
#define MOZ_DRAW_TEXT_WITH_GDK
#ifndef MOZ_DRAW_TEXT_WITH_GDK /* gdkxft patch */
Save the file, then type this:
pushd
ebuild ./mozilla-1.0.1-r3.ebuild compile install qmerge
That last command may take a while to run ;)
Once it's done, you have to run mozilla and tweak your font settings under Preferences. You must pick fonts from the "b&h", "urw", "freefont", "macromedia", "sharefont", "abiword", or "abisource" families. Usually you have to install abiword to get any abisource fonts.
Here's a screenshot of my mozilla showing which fonts I picked.
Also, you will want to get out a ruler, drop down the "Display Resolution" box, choose "Other...". Measure the line and type in your measurement to determine the DPI of your screen.