#!/bin/sh
#
#  Copyright (c) 1998
#   Sergey A. Babkin.  All rights reserved.
#
#  Redistribution and use in source and binary forms, with or without
#  modification, are permitted provided that the following conditions
#  are met:
#  1. Redistributions of source code must retain the above copyright
#     notice, this list of conditions and the following disclaimer.
#  2. Redistributions in binary form must reproduce the above copyright
#     notice, this list of conditions and the following disclaimer in the
#     documentation and/or other materials provided with the distribution.
#
#  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
#  Sergey A. Babkin (sab123@hotmail.com, babkin@bellatlantic.net)
#

# the directores with fonts for X11 (the same as DSTDIR in `convert')
XDIRS="/usr/X11R6/lib/X11/fonts/ttf"

# the base directory of Ghostscript
GSDIR=/usr/local/share/ghostscript

# the font directory of Ghostscript
FONTDIR=$GSDIR/fonts

# the configuration directory of Ghostscript
CONFDIR=$GSDIR/5.10

# link the fonts to FONTDIR

rm -f $CONFDIR/Fontmap.ttf

for d in $XDIRS
do
	for i in $d/*.pfa
	do
		[ -f $i ] || break;

		n=`basename $i`

		rm -f $FONTDIR/$n

		ln -s $i $FONTDIR/$n || {
			echo "Unable to link $n to GS font directory">&2
		}
	done

	cat $d/Fontmap.ttf >>$CONFDIR/Fontmap.ttf
done
