Friday, 19 November 2010

LFS - Fonts

The standard font that X comes with is, bluntly, shit. So lets install some new fonts to brighten everything up.

Firstly, setup the directory to store the downloaded files in:

mkdir /sources/fonts
cd /sources/fonts

Next download a bog standard, and nice looking, free font, Dejavu. The commands basically 1. make a folder in /usr/share/fonts 2. copies all ttf files into that directory 3. runs the program fc-cache to load the ttf files.

wget http://sourceforge.net/projects/dejavu/files/dejavu/2.32/dejavu-fonts-ttf-2.32.tar.bz2/download
tar -jxvf dejavu-fonts-ttf-2.32.tar.bz2
cd dejavu-fonts-ttf-2.32/ttf
install -v -d -m755 /usr/share/fonts/dejavu &&
install -v -m644 *.ttf /usr/share/fonts/dejavu &&
fc-cache -v /usr/share/fonts/dejavu
cd ../../
rm -rf dejavu-fonts-ttf-2.32

Next we are going to install some Microsoft fonts - which are freely licensed. To do this we are going to need a bit of software to unpack the Microsoft archive:

wget http://www.cabextract.org.uk/cabextract-1.2.tar.gz
tar -xzvf cabextract-1.2.tar.gz
cd cabextract-1.2
./configure --prefix=/usr &&
make
make install
cd ..
rm -rf cabextract-1.2

Now we need to get the fonts:

wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/andale32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/arial32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/arialb32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/comic32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/courie32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/georgi32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/impact32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/times32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/trebuc32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/verdan32.exe/download
wget http://sourceforge.net/projects/corefonts/files/the%20fonts/final/webdin32.exe/download

We then install the fonts using a bit of a script to automate the repetitive commands. Apart from the cabextract command basically we are doing the same as the Dejavu commands above.

for msfont in andale32 arial32 arialb32 comic32 courie32 georgi32 impact32 times32 trebuc32 verdan32 webdin32
do
mkdir $msfont
cabextract $msfont.exe -d $msfont
cd $msfont
install -v -d -m755 /usr/share/fonts/$msfont
install -v -m644 *.TTF /usr/share/fonts/$msfont
install -v -m644 *.ttf /usr/share/fonts/$msfont
fc-cache -v /usr/share/fonts/$msfont
cd ..
rm -rf $msfont
done

I am not entirely sure if this last step actually does anything, but it is supposed to make a config file which anti aliases the fonts.

cat > ~/.fonts.conf << "EOF"
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
 <match target="font">
   <edit name="autohint" mode="assign">
     <bool>true</bool>
   </edit>
 </match>
</fontconfig>
EOF

No comments:

Post a Comment