# Microsoft's TrueType core fonts
# ===============================
# Prerequisites:
# cabextract
# fontconfig (if you run fc-cache, etc.)
# This will install Microsoft TrueType core fonts for use with X,
# ImageMagick, etc.
# Create a place to keep the .exe files and a temporary directory to
# extract them in to
# This assumes you can write to /tmp as any user
mkdir -p -m 0700 ~/installed/msttcorefonts /tmp/msttcorefonts
# Change to the directory where the .exe files will go
cd ~/installed/msttcorefonts
# Download each one, keeping it if it's already there
for font in andale arial arialb comic courie georgi impact times trebuc \
verdan wd97vwr webdin;
do
wget -nc http://downloads.sf.net/corefonts/${font}32.exe
done
# Extract each cab .exe file with cabextract, into /tmp/msttcorefonts
for file in ./*.exe;
do
cabextract -q -L -F "*.ttf" -d /tmp/msttcorefonts $file
test $? != 0 && ( echo "ERROR extracting ${font}32.exe" ; exit 1 )
done
# List each extracted .ttf file
ls -lh /tmp/msttcorefonts/*.ttf
# Become root to move the .ttf files in place
su
# Create a directory to keep the .ttf files in
mkdir /usr/share/fonts/msttcorefonts
# Move all of the .ttf files into /usr/share/fonts/msttcorefonts
mv /tmp/msttcorefonts/* /usr/share/fonts/msttcorefonts/
# We don't need the temporary directory any more
rmdir /tmp/msttcorefonts
# Make sure everything is owned by root (i.e. not your non-root user)
chown -R root:root /usr/share/fonts/msttcorefonts
# If X's mkfontdir is there, run it on the new font directory
test -x /usr/X11R6/bin/mkfontdir &&
/usr/X11R6/bin/mkfontdir /usr/share/fonts/msttcorefonts
# If fc-cache is there, run it on the new font directory to create an
# updated cache of all FreeType fonts
# Look in /var/cache/fontconfig or run fc-cache with strace to find out
# where the cache is
test -x /usr/X11R6/bin/fc-cache &&
/usr/X11R6/bin/fc-cache /usr/share/fonts/msttcorefonts
# If fc-cache is here and the /usr/X11R6/bin one is not, same deal
test ! -x /usr/X11R6/bin/fc-cache &&
test -x /usr/bin/fc-cache &&
/usr/bin/fc-cache /usr/share/fonts/msttcorefonts
# Run fc-list to see all fonts that are known to fontconfig