Automatically sucking in Truetype fonts from a Windows partition

Thursday, April 08 2004 @ 08:48 AM EST

Contributed by: deece

For those of you dual booting an X-Windows machines with Windows, read on for a couple of scripts to make your like a bit easier.

First, dump the following into /usr/local/bin/linkfonts (and then make it executable):

#!/bin/sh

srcDir="/windows/WINDOWS/Fonts"
tgtDir="/usr/X11R6/lib/X11/fonts/TTF"

cd $srcDir

for font in *.ttf ; do
name=`echo "$font" | sed s/\.ttf$//`
ln -s $srcDir/$font $tgtDir/$name.ttf 2> /dev/null &
done


for font in *.TTF ; do
name=`echo "$font" | sed s/\.TTF$//`
ln -s $srcDir/$font $tgtDir/$name.ttf 2> /dev/null &
done


====================================

Now, in /usr/local/etc/rc.d/linkfonts.sh, enter the following (again make it executable)

#!/bin/sh

case "$1" in
start|restart)
if test -e /usr/local/bin/linkfonts ; then
/usr/local/bin/linkfonts
fi
;;
stop)
;;
esac


====================

Now, edit the first script and change the source path to suit your Windows installation and try running it. It should automatically populate your X11 Truetype fonts from your Windows installation - easy!

0 comments



http://www.bsd.net.au/article.php?story=20040408084858320