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).

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:

<dir>/usr/share/fonts/TTF</dir>

Save.

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

Open site http://www.utusan.com.my

:)

6 Responses to “Display Microsoft fonts like in Windows in CentOS/Fedora”

  1. irwanj Says:

    Pi install msttcorefonts tu. Kalau nak senang, cari yg RPM-ready.

  2. syiron Says:

    Fedora / Centos
    Here we will need a little more job

    1. Install the software needed

    sudo yum install rpm-build cabextract

    2. Download the specs to build the RPM

    wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec

    3. Build the RPM

    rpmbuild -ba msttcorefonts-2.0-1.spec

    4. Install the RPM

    rpm -ivh /usr/src/redhat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm

  3. Alex Mirkin Says:

    Excellent – many thanks !!

  4. CentOS Desktop: It Can Be Done « Just Passing Through Says:

    [...] in Linux, and it works fine. You may also have heard of the freetype bytecode rendering issue. The recipe isn’t that hard to find, but in this case it required knowing freetype was recently updated, [...]

  5. Yusuf Motiwala Says:

    Nice stuff. Btw, avoid msfonts-rules.conf from font config files. Font looks much better without it.

  6. Kevin Says:

    Hi all,

    I have a small problem. How can I restore the linux font after installing microsoft font????

    Thanks in advance.

Leave a Reply