Display Microsoft fonts like in Windows in CentOS/Fedora

14 01 2008

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

:)

Advertisements

Actions

Information

10 responses

15 01 2008
irwanj

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

15 01 2008
syiron

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

8 02 2008
Alex Mirkin

Excellent – many thanks !!

24 12 2008
CentOS Desktop: It Can Be Done « Just Passing Through

[…] 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, […]

27 02 2009
Yusuf Motiwala

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

21 05 2009
Kevin

Hi all,

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

Thanks in advance.

18 03 2011
pkc

Still works for CentOS 5.5. I have stumble across this blog posting a few times over the last couple years after lots of Googling. Thanks!

20 10 2011
jamal

Merci infiniment

Jamal from maroc ;)

30 05 2013
hotmail email

Hello very cool website!! Guy .. Beautiful .. Superb .
. I will bookmark your blog and take the feeds additionally?

I am satisfied to find numerous helpful info right here within the publish, we’d like work out more techniques in this regard, thank you for sharing. . . . . .

2 08 2013
Lisette

Proteins, vitamins, minerals and amino acids play a massive role in assisting
you grow taller.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: