Software Developer

Wednesday, August 22, 2007

How did I improve fonts rendering on my Ubuntu Edgy

I have already been almost 3 months working only with linux ubuntu, and I really love it! Just decided right now to make some short articles where I will try to collect some thoughts about how did I achieve different results.

This is how does it look right now on my laptop:


The first thing that I really didn't like when you just install Ubuntu - it is font. So this is what have I done to improve that.

First we need to add some new repos to our sources list. Open gnome-terminal and type:

gksudo gedit /etc/apt/sources.list


If you have edgy - add this lines:

deb http://www.telemail.fi/mlind/ubuntu edgy fonts
deb-src http://www.telemail.fi/mlind/ubuntu edgy fonts


Or if you have Fiesty:

(Fiesty)
deb http://www.telemail.fi/mlind/ubuntu feisty fonts
deb-src http://www.telemail.fi/mlind/ubuntu feisty fonts


After that we need to add gpg keys:

gpg --keyserver subkeys.pgp.net --recv-keys 937215FF
gpg --export --armor 937215FF | sudo apt-key add -


Then update/upgrade:

sudo aptitude update
sudo aptitude upgrade


We installed all the updates, so now we need to reconfigure our fonts:

sudo dpkg-reconfigure fontconfig-config

Choose next options: Native, Automatic, No bitmapped fonts

After that:

sudo dpkg-reconfigure fontconfig


Now we create a fonts.conf file in our home directory:

sudo gedit ~/.fonts.conf

and add next lines there:

<fontconfig>
<match target="font">
<test name="weight" compare="more"><const>medium</const></test>
<edit mode="assign" name="autohint"><bool>false</bool></edit>
</match>
</fontconfig>


You also can add this peace of code directly to the /etc/fonts/fonts.conf. But i prefer the previous method.

After that we need to make some changes to /etc/X11/xorg.conf file. By the way - don't forget to make a backup of the xorg.conf file, just for emergency.

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_my_todays_backup
gksudo gedit /etc/X11/xorg.conf

In Monitor section we need to add:

DisplaySize 370.4 277.8 #1400x1050

this is for 1400x1050 resolution or

DisplaySize 381 238.125 #1440x900

(This is exactly my case right now:). By the way , if you have another resolution - just use this formula to count your numbers:
X = [horizontal resolution] X 25.4 / 96;
1400 х 25.4 / 96 = ~370.4
Y = [vertical resolution] X 25.4 / 96;
1050 х 25.4 / 96 = ~277.8

So that's it!
Just close and save everything. Type Ctrl-Alt-Bksp (to reload Gnome) and see the result. For me it was really impressive.

No comments: