msttcorefonts on RHEL6 / Centos 6 / SL6

msttcorefonts is a way of obtaining the Microsoft TrueType fonts on Linux. However, version 6 release of Red Hat Enterprise Linux no longer includes a pre-requisite of msttcorefonts package, namely chkfontpath, which in turn, relies on the font server package xfs.

The latest version of msttcorefonts at sourceforge doesn’t cater for this, so in the meantime we can patch the spec file and build it ourselves.

1) Download the spec file from http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec
2) Patch the spec file. Create a file called msttcorefonts.rhel6.patch, containing the following:

--- msttcorefonts-2.0-1.spec	2011-09-05 11:09:57.206756336 +0100
+++ msttcorefonts-2.0-1.1.spec	2011-09-05 11:23:56.925761649 +0100
@@ -19,8 +19,8 @@
 BuildPrereq: %{ttmkfdir}
 BuildPrereq: wget
 BuildPrereq: cabextract
-Prereq: /usr/sbin/chkfontpath
-Packager: Noa Resare <noa@resare.com>
+#Prereq: /usr/sbin/chkfontpath
+#Packager: Noa Resare <noa@resare.com>
 
 %description
 The TrueType core fonts for the web that was once available from
@@ -152,7 +152,7 @@
 %post
 if test $1 -eq 1
 then
-	/usr/sbin/chkfontpath --add %{fontdir}
+	ln -s /usr/share/fonts/msttcorefonts/ /etc/X11/fontpath.d/msttcorefonts
 fi
 # something has probably changed, update the font-config cache
 if test -x /usr/bin/fc-cache
@@ -163,7 +163,7 @@
 %preun
 if test $1 -eq 0
 then
-	/usr/sbin/chkfontpath --remove %{fontdir}
+	/bin/rm -f /etc/X11/fontpath.d/msttcorefonts
 fi
 
 %files

3) Patch the spec file by running the following command in the same directory as the .spec file and the .patch file

patch < msttcorefonts.rhel6.patch
Visually inspect the resulting spec file to verify that it no longer requires chkfontpath.

4) Rebuild the rpm package using the new spec file
rpmbuild -bb msttcorefonts-2.0-1.spec

5) Finally, copy the resulting RPM to your local repository, or install locally with
yum localinstall msttcorefonts-2.0-1.noarch.rpm

Advertisements
This entry was posted in Linux, RHEL and tagged , , , , , , , , . Bookmark the permalink.

14 Responses to msttcorefonts on RHEL6 / Centos 6 / SL6

  1. Roy says:

    Thanks for the instructions. They worked great. Received a message that the rpm was not signed so I just rpm -ivh the file and it installed perfectly. Thanks again.

  2. azca says:

    Thanks! Worked perfectly!

  3. Thanks! Was perfect! Warked pefectly!!!!

  4. ryran says:

    Excellent. Appreciate it!

  5. rsargent says:

    I think an ‘if’ is not closed unless this output is expected.
    patching file msttcorefonts-2.0-1.spec
    patch unexpectedly ends in middle of line
    Hunk #3 succeeded at 163 with fuzz 1.

    Using CentOS release 6.3 (Final)

  6. Kevin says:

    Thanks. Worked first go and saved me a lot of time.

  7. Rob says:

    Wonder where I went wrong. I had to manually “uncab” the font files and install them manually

  8. Narcis says:

    thanks a lot

  9. klemen says:

    I’m on CentOs and I get:
    “cabextract is needed by msttcorefonts-2.0-1.noarch…” after issuing:
    rpmbuild -bb msttcorefonts-2.0-1.spec

  10. rf says:

    so install it from the rpmforge repo.
    `yum install cabextract`

  11. Sargis says:

    Thank you much. Works great on CentOS release 6.4 (Final).

  12. Simon says:

    it’swork on RHEL 6.4. Thanks so muc

  13. Mark D. says:

    Thank you for this. Worked fine on CentOS 6.6.

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