Sharp, Non Anti-Aliased Fonts in Fedora / CentOS

By default the Centos/Fedora fonts are heavily anti-aliased and look annoyingly blurry to me. I prefer the sharp, hinted fonts as seen in XP. Since Apple has a patent on the technology used for it, many Linux distros ship with the Byte-code Interpreter (BCI) feature disabled. To enable it, we need download the Freetype source RPM, tweak the spec file, and recompile it. It is also possible to get the standard MS fonts installed as they have provided a redistributable collection of the most popular ones.

1) Install the required packages. The cabextract package is in the Extras repository.

sudo yum install -y wget rpm-build ttmkfdir cabextract

2) If you don’t already have an rpm build directory set it up along with an RPM preference file. Replace <user> with the appropriate user account in the second command. You add your own name to the %packager variable.

mkdir -p ~/rpm/BUILD ~/rpm/RPMS ~/rpm/SRPMS ~/rpm/SPECS ~/rpm/SOURCES ~/rpm/tmp
echo “%_topdir       /home/user/rpm” > ~/.rpmmacros
echo “%packager      Last_Name First_Name” >> ~/.rpmmacros
echo “%_rpmfilename  %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm” >> ~/.rpmmacros

Download and install the Freetype source RPM. The URL will change depending on the distribution and release.
(CentOS)

wget http://mirror.linux.duke.edu/pub/centos/5/os/SRPMS/freetype-2.2.1-19.el5.src.rpm

(Fedora)

wget http://mirror.linux.duke.edu/pub/fedora/linux/releases/9/Fedora/source/SRPMS/freetype-2.3.5-4.fc9.src.rpm
rpm -ivh freetype*.src.rpm

3) Edit the SPEC file and change the bytecode variable.
(CentOS)

vi ~/rpm/SPECS/freetype.spec

%define without_bytecode_interpreter    0

rpmbuild -bb ~/rpm/SPECS/freetype.spec
sudo rpm -Uvh –force ~/rpm/RPMS/freetype-2*.rpm

(Fedora)

rpmbuild -bb ~/rpm/SPECS/freetype.spec –with bytecode_interpreter
sudo rpm -Uvh –force ~/rpm/RPMS/freetype-2*.rpm

4) Install the MS fonts.

wget -P ~/rpm/SPECS http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
sudo mkdir /usr/share/fonts/msttcorefonts
rpmbuild -bb ~/rpm/SPECS/msttcorefonts-2.0-1.spec
sudo rpm -ivh –nodeps ~/rpm/RPMS/msttcorefonts-2.0-1.noarch.rpm

You may see an error regarding /usr/sbin/chkfontpath, ignore it.

5) Setup your base anti-aliasing and hinting preferences file (modified from http://www.howtoforge.com/sharp_fonts_gnome_p3.

wget -P ~ http://128.148.4.34/dump/.fonts.conf

6) Tell yum to ignore any updates to Freetype as any automatic updates will not be compiled with BCI enabled.

vi /etc/yum.conf

exclude = freetype*

7) Next you will need to select the default fonts you’d like to use in Gnome. (CentOS = System > Preferences > Fonts) (Fedora = System > Preferences > Look And Feel > Appearance, Fonts tab). I use Tahoma, size 8 for all four options.

You may notice the Tahoma bold font looks ugly. It’s because MS did not provide that in the font package. However you can manually copy it from any windows system and place the file in /usr/share/fonts/msttcorefonts/ to fix the annoyance.

Advertisements

About this entry