One of the most requested feature in aMSN for Linux is font antialiasing. Its benefits are smoother fonts and clearer readability. In this article we'll explain how to obtain this feature and how the situation is going to evolve in the near future in Linux distributions.
Introduction and historical notes
aMSN is written with the Tcl programming language and the Tk widget toolkit. Font antialiasing is not an aMSN feature; it depends on graphical toolkit capabilities. Tk 8.4 for Linux didn't support antialiasing, now Tk 8.5 supports it and enables it by default. This means that nothing could be done inside aMSN to turn on this feature: to have antialiased fonts you should have Tk 8.5 with this option enabled at compile time (or better, as we'll see after, at configure time).
The most part of aMSNs found in distributions are compiled in front of Tk 8.4 so there is no way to enable antialiasing other than compiling Tcl/Tk 8.5 from sources. This is because Tcl/Tk 8.5 has been relased as stable only in December 2007. In the near future more and more distribution will begin to ship aMSN with antialiasing by default (or, to say it properly, compiled in front of Tcl/Tk 8.5). As you can see aMSN in Debian Lenny (which is the testing version of the next stable release) is already compiled against Tcl/Tk 8.5 and so will do a lot of other distros.
So possible solutions to the problem are:
- wait a couple of months for the newest release of the distribution of your choice;
- install a backport;
- compile properly Tcl/Tk 8.5 and aMSN 0.97 from sources using the following guide or the official Compiling_aMSN guide.
Releases that will include Tcl/Tk 8.5
If you want to know exactly how long you should wait see the table of upcoming releases on Distrowatch.com (note that the list is weekly updated, if you want to read the latest go to the Distrowatch weekly and open the latest issue);
Here you are a list of the most important distributions that will include Tcl/Tk 8.5 in their repositories as default:
- Ubuntu 8.04;
- Fedora 9;
- Mandriva 2008.1;
- openSuse 11;
- Debian 5.0;
- many others.
Ubuntu 7.10 - Gutsy Gibbon: both Tcl/Tk 8.5 and aMSN 0.97 have been backported to Gutsy so you just need to enable the backports repository and install the new aMSN. A good guide about backports can be found here.
Debian 4.0 Etch: people who run Debian stable can install aMSN from Debian Lenny following this official guide about apt-pinning or this unofficial guide to apt-pinning. Just remember that, as of now, stable=etch and testing=lenny but apt-pin accepts only the stable/testing/unstable/experimental terminology (e.g. contrary to /etc/apt/sources.list the configuration file /etc/apt/preferences doesn't accept etch or lenny as a parameter for "release").
Installing needed libraries
To compile a package from sources several things are needed: we need a compiler, some libraries and some headers. In this case we need gcc, some Dev_Packages to build Tcl/Tk 8.5 and libxft-dev to get antialiased fonts.
Luckily all major distributions provide some tools to easily obtain development packages to build some specific applications or libraries.
Debian, Ubuntu and distributions with apt-get
If you have a Debian based distribution that doesn't have Tcl/Tk 8.5 in its repositories (like Debian 4.0 "etch" or Ubuntu 7.10 "Gutsy Gibbon") you'll need to install some packages.
sudo only if it's properly configured (like in Ubuntu), otherwise login as root with
su - and then type the following lines without
sudo at the beginning.
This will download building dependencies for Tcl/Tk (they are the same for 8.4 and for 8.5, the one we need):
sudo apt-get build-dep tcl tk
Then you'll need developement package for libxft:
sudo apt-get install libxft-dev
If you plan to download sources from Tcl/Tk from cvs (not recommended) you'll also need to install it:
sudo apt-get install cvs
RHEL, Fedora and yum based
Red Hat based distributions use the yum package manager. A tool similar to
apt-get build-dep is included in the package yum-utils and is called
yum-builddep. So, after becoming root with
su - you should install yum-utils:
yum install yum-utils
install the building dependencies:
yum-builddep tcl tk
install libXft-devel (needed by Tk antialiasing), libpng-devel and libjpeg-devel (both needed by aMSN):
yum install libXft-devel libpng-devel libjpeg-devel
NOTE: please be sure to check that
X is written in capital letters.
And, if you need it, cvs:
yum install cvs
Downloading Tcl and Tk 8.5
As of now Tcl/Tk 8.5 libraries are released as stable so it is wise to download the sources directly from the official website. In the download page the latest bugfix release can be found; both the Tcl and the Tk sources should be downloaded.
When the download is complete just unpack the archive with your favorite tool. To do it from command line:
tar xzf tcl8.5.x-src.tar.gz tar xzf tk8.5.x-src.tar.gz
x obviously stands for the bugfix version you downloaded.
Compiling and installing Tcl/Tk8.5
Note: this may take several minutes. While waiting you can enjoy some tuxracer or minesweeper :D The following instructions will put tcl/tk8.5 in /usr/local
cd tcl/unix ./configure --prefix=/usr/local --includedir=/usr/local/include/tcl8.5 --enable-shared --enable-threads --enable-64bit \ --mandir=/usr/local/share/man --enable-man-symlinks --enable-man-compression=gzip && make CFLAGS="-g -O2 -D_REENTRANT" sudo make install
- Note: this way you're enabling threads. This may cause hangs under kernel of the 2.6 series. If you experience such a problem, please recompile Tcl/Tk without threads (just remove --enable-threads from the command line).
- Some users (such as NoWhereMan) complain they've never had any problem compiling this way. They were deported and nobody knows anymore anything about them. Someone thinks they're still around, and they keep on posting on the forum or writing articles such as this on the wiki.
cd ../../tk/unix ./configure --prefix=/usr/local --includedir=/usr/local/include/tcl8.5 --with-tcl=/usr/local/lib --enable-shared --enable-threads \ --enable-64bit --enable-man-symlinks --enable-man-compression=gzip --enable-xft && make CFLAGS="-g -O2 -D_REENTRANT" sudo make install
- Note: if you haven't enabled threads above, you'll probably have to disable them here, too.
Compiling aMSN to use antialiasing
Follow the instructions found here (Installing_SVN) but use this line when you do
./configure --with-tcl=/usr/local/lib --with-tk=/usr/local/lib
If you try launching aMSN right now, all you'll get is a segmentation fault. Why? Well, indeed you installed the new Tcl/Tk version, but the old one is still there and, worse, is still the one that is called when you type such as
tclsh, which are the Tcl/Tk binaries.
So you have to tell your system that when you type
wish, it is supposed to run
wish8.5 instead of the old
wish8.4. Do you have any idea how? Well, go to
/usr/local/bin (or wherever these stuff are installed) and do:
ls -l tclsh* wish*
You'll probably see something like this:
lrwxrwxrwx 1 root root 8 Nov 17 00:17 tclsh -> tclsh8.4 -rwxr-xr-x 1 root root 6192 Jul 20 16:28 tclsh8.4 -rwxr-xr-x 1 root root 7689 Nov 17 00:14 tclsh8.5 lrwxrwxrwx 1 root root 7 Nov 17 00:16 wish -> wish8.4 -rwxr-xr-x 1 root root 6968 Jul 20 17:08 wish8.4 -rwxr-xr-x 1 root root 8572 Nov 17 00:24 wish8.5
As you can see, both
tclsh are pointing to the 8.4 tools. To fix this and use the new version by default, do the following (in the directory Tcl/Tk binaries were installed):
- If your distribution is based on Debian (that includes Ubuntu), try this:
sudo update-alternatives --config tclsh && sudo update-alternatives --config wish
- If no choice is provided, then add it:
sudo update-alternatives --install $(which tclsh) tclsh /usr/local/bin/tclsh8.5 900;
sudo update-alternatives --install $(which wish) wish /usr/local/bin/wish8.5 900;
- and then retry the configuration.
- If your distribution is not based on Debian, link it manually:
sudo ln -sf tclsh8.5 tclsh
sudo ln -sf wish8.5 wish
Now the system uses by default the newer set of Tcl/Tk tools. The usual
amsn command should work fine!
Enjoy your brand-new fresh-looking smooth-fronted aMSN!
Keeping the old Tcl/Tk versions as default
If you want to use aMSN with the newly-compiled antialiased Tcl/Tk, but still want to keep the old installation as default, just don't update the symbolic links as mentioned above. You will, though, have to run aMSN with the command
instead of simply doing
because the latter will use
wish8.4. So creating an alias, script or desktop item in this case might be a good idea.
Installing Tcl/Tk in your home directory
We now assume that you have already downloaded the needed libraries and sources (included aMSN).
To make the whole procedure more generic we'll set an environment variable to define were we'll install Tcl/Tk. To create this variable type the following command:
a good example is:
remember this should be relative to your home directory so that the following command:
should output something like this:
Ok, so now we are ready to compile! Enter in the directory you extracted the downloaded sources. We should respect this order:
Configure, compile and install Tcl
Now that you are in the directory of Tcl sources enter the
now you can list the configure options by typing:
Choose the options you prefer. I experienced problems with the
--enable-threads option so i decided to keep it off (as default). On the contrary
--enable-shared is enabled by default so it's not necessary to add it to the configure line.
./configure --prefix=$HOME$INST_PATH --includedir=$HOME$INST_PATH/include/tcl8.5 --mandir=$HOME$INST_PATH/share/man --enable-man-compression=gzip
If something has failed check for errors or missing libraries, if you experience difficulties report them in the forums. If all went well you can now compile using make:
make CFLAGS="-g -O2 -D_REENTRANT"
If also compiling finished successfully you can then install Tcl in your home directory:
Configure, compile and install Tk
The same things should be done with Tk sources, so enter Tk sources directory, enter "unix" subdirectory:
review configure options:
As you can see
--enable-xft, which are the libraries that enable font antialiasing, is on by default (but be sure so have
libxft-dev installed) so run:
./configure --prefix=$HOME$INST_PATH --includedir=$HOME$INST_PATH/include/tcl8.5 --with-tcl=$HOME$INST_PATH/lib --enable-man-compression=gzip
and then compile:
make CFLAGS="-g -O2 -D_REENTRANT"
If all went well typing:
should list the following directories:
bin include lib man share
If you want you can create a symlink (symbolic link) to the new Tcl/Tk executables in this way:
ln -s * ~/bin
This will make it possible for you to use the Tcl/Tk 8.5 installed in your home directory by just using the commands
$HOME/bin should be in your
PATH environment variable. To check you
PATH variable type:
env | grep PATH
If you want to learn how to set environment variables you can read this guide.
Configure, compile and install aMSN
Now it's time to get aMSN working. With the usual procedure do:
./configure --with-tcl=$HOME$INST_PATH/lib --with-tk=$HOME$INST_PATH/lib
Note: Only running "
./configure" will use the old Tcl/Tk version and cause a
tkcximage error when starting amsn.
If you've compiled it before be sure to run also:
This will rebuild the aMSN with the new Tcl/Tk 8.5.
will start amsn with beautiful fonts.
IMPORTANT NOTE: Anti-aliasing only works with TrueType fonts. Make sure when you start aMSN that you are using the a suitable font by going to Account -> Properties -> Interface -> Change Fonts and then select a TrueType font.
A simple way to start it is creating a desktop shortcut or a script like:
#!/bin/bash wish8.5 $HOME/personal_aMSN/amsn-0.xx/amsn
Save that as
amsn in your
~/bin directory and add executable permissions:
chmod u+x amsn
After that, the only thing to do to start it is running the command
amsn. You can create an icon shortcut, or simply press
Alt+F2 and type:
That's it! :)
This article has a Spanish version
Here you are some related links to further investigate the subject. Some of them are outdated but could however be useful for troubleshooting.