Thursday, June 25, 2009

Display Microsoft fonts like in Windows in CentOS/Fedora

Staying in front of your computer for hours and hours with the default fonts can be a challenge on Linux/Unix. I, for one, can’t work properly without the Windows fonts comfort :)

Having the windows fonts working on Unix systems is fairly easy, but on Red Hat-based operating systems such as CentOS or Fedora, can be a real nightmare. The most critical aspect of having the Microsoft fonts to display properly on CentOS in compiling freetype with bytecode interpreter enabled. Let’s go through this procedure.

This tutorial assumes you have the 3 most popular community repositories enabled (Karanbir Singh, Dag Wieers and Dries).
((http://www.osresources.com/11_6_en.html))

1. Create the system source tree:

$ su
# mkdir -p /usr/src/redhat/SPECS


2. Download the latest version of the Freetype source code from a CentOS repository – For instance: freetype-2.*.el5.src.rpm – To your desktop (has to have a .src.rpm extension) and install the source:

# rpm -Uvh ./Desktop/freetype-2.1.9-1.0.rf.src.rpm

3. Open the spec (make) file in a text editor:

# gedit /usr/src/redhat/SPECS/freetype.spec

And enable the bytecode interpreter changing this line:

%define without_bytecode_interpreter 1

To:

%define without_bytecode_interpreter 0

(And not the opposite!)
Save.

4. Install some essential compilation tools and a few upgrades:

# yum install gcc-c++ rpm-build xorg-x11-deprecated-libs-devel xorg-x11-devel automake autoconf libtool zlib-devel libX11-devel


5. Build Freetype:


# cd /usr/src/redhat/SPECS
# rpmbuild -ba freetype.spec


6. Now you should have your RPMs:

# cd /usr/src/redhat/RPMS/i386 && ls
freetype-2.1.9-1.2.rf.i386.rpm freetype-devel-2.1.9-1.2.rf.i386.rpm
freetype-demos-2.1.9-1.2.rf.i386.rpm freetype-utils-2.1.9-1.2.rf.i386.rpm
#


7. Install the new version of Freetype:

# rpm -Uvh --force *

8. Download the Microsoft fonts and extract them:

# mkdir /usr/share/fonts/TTF
# tar xvjpf msfonts.tbz -C /usr/share/fonts/TTF/


Download the fontconfig files and extract them into your fontconfig directory:

# tar xvjpf fontconfig.tbz -C /etc/fonts/

9. Make sure the fonts directory is listed in the fontconfig configuration file:

# gedit /etc/fonts/fonts.conf

ie:

/usr/share/fonts/TTF
Save.

10. Log out from Gnome/KDE and relog in. Now here’s how your fonts should look like:

No comments:

Post a Comment

tag ur valuable ideas below