Monday, December 7, 2009

Rebuilding Firefox with " –enable-system-cairo "

I'm not using Iceweasel, but always downloaded the latest stable version of Firefox from their site.

Now with using patched libfreetype6, libcairo2 and libxft2 I had the problem that the Firefox binary from Mozilla is statically linked. The solution is to rebuild them to be dynamically linked against your system libraries (particularly Cairo).

The first thing you need to do is get the source code. Move it to a directory e.g "src" on your Desktop.
tar xf firefox-3.5.5.source.tar.bz2 will extract it. You will get a directory "/src/ mozilla-1.9.1/ ".
You need to patch the source file ’cause it has a bug when you compile with the ‘–enable-system-cairo’ .  Get the patch from here: https://bugzilla.mozilla.org/show_bug.cgi?id=466250 .
Save the patch file in your ‘mozilla-1.9.1′ directory. Patch the source: patch -p1 < patch-filename.
Before we go any further you need to install a lot of building dependencies, sudo apt-get build-dep iceweasel .
When building you will get errors, take a note of them and see what else you need.

Next step will be to make a textfile .mozconfig in your  "/src/ mozilla-1.9.1/ ".
Put the following inside the .mozconfig file:


mk_add_options MOZ_CO_PROJECT=browser
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt
ac_add_options --enable-application=browser
ac_add_options --disable-tests
ac_add_options --enable-optimize --disable-debug
ac_add_options --enable-default-toolkit=cairo-gtk2 --enable-system-cairo
ac_add_options --disable-crashreporter

For the make script to be able to find your .mozconfig do :
export MOZCONFIG=/home/username/Desktop/src/mozilla-1.9.1/.mozconfig

Now in your "/src/ mozilla-1.9.1/ " directory, start a terminal and issue the build command:
make -f client.mk build
Now be patient, this is taking some time !
When its is all done, cd into the directory ‘mozilla-1.9.1/ff-opt/dist/bin’ and run the executable ‘firefox’.

cd mozilla-1.9.1/ff-opt/dist/bin  and start your brandnew firefox :
./firefox -P -no-remote
-P  will start the profilemanager, -no-remote will let you run firefox with a new choosen profile even when other firefox windows are already open.

To package the build:
cd mozilla-1.9.1/ff-opt/
make package

The new package will be located in ‘ff-opt/dist/’

Move your firefox folder in e.g your home directory, and make a link on your Desktop, taskbar, menu :   /home/username/firefox/firefox -P "profile-name" -no-remote

Downloads :
patch
.mozconfig

Already built packages :
firefox-3.5.5.en-US.linux-i686.tar.bz2
firefox-3.5.5.en-US.langpack.xpi ( save link as )


Type in " about:buildconfig " in the adress bar :

Sunday, December 6, 2009

Improved Subpixel Font Rendering

Subpixel font rendering capabilities in Lenny can easily be improved by applying patches to the source code of libcairo2, libxft2 and libfreetype6. These patches have been around for years, but are not used in your default installation.
I have patched and built Lenny’s debs according the following guide : http://divenvrsk.livejournal.com/628.html. They gave me the same result as the debs from here (1): http://forums.debian.net/viewtopic.php?f=6&t=45315&start=0.
The result is beautiful, but the fonts are a bit to bold ( my taste ). I still had an old, unused install of Ubuntu Gutsy on a different harddisk, the rendering looked a bit different and was my favorite.
I was happy to come across this site (2) : http://bekirserifoglu.net/2009/02/20/subpixel-font-rendering-in-linux/ . These debs gave me the same result !

Results : from left to right : default debs, debs link1, debs link2




You can grab these debs here ;
(1) http://dl.dropbox.com/u/223420/cleartype/debs1.tar.gz
(2) http://dl.dropbox.com/u/223420/cleartype/debs2.tar.gz

I've noticed a difference in the "configure anti-alias settings" box between the two

(1)



Use sub-pixel hinting grayed out !

(2)



Not grayed out !

I use candara size 11 in general ( K-menu - Settings - Appearance & Themes - Fonts, the fontsettings in firefox for rendering the pages are shown below



sudo dpkg-reconfigure fontconfig-config

Choose Native - Always - No

My .fonts.conf