#!/bin/sh

#
#	SID	@(#)sff_install.sh	3.2 - 95/03/16
#
# this is a very simple install script for the SFF fonts found in this
# directory.  it just runs the bdftosnf or bdftopcf program, and dumps
# the output into some other directory, most likely a local X11 font
# directory.
#
# after that, the system administrator will have to run the mkfontdir
# program and other X11 font installation procedures as needed.
#
CMD=bdftopcf
SUF=pcf
case "$1" in
-pcf)		CMD=bdftopcf;	SUF=pcf;	shift ;;
-snf)		CMD=bdftosnf;	SUF=snf;	shift ;;
-fb)		CMD=convertfont;	shift ;;
-*)
	cat <<BLEE
Usage: $0 { -snf | -pcf | -fb } font_directory

This shell script converts the distributed BDF font files into a
form that can, hopefully, be used locally with your X server.

Command line options:

-pcf	converts the fonts to PCF format.  This is the default conversion.

-snf	converts the fonts to SNF format.

-fb	converts to X11/NeWS format (Sun/Solaris).

The font_directory is where output is placed.  There is no default.
BLEE
	exit 0 ;;
esac
if [ $# -ne 1 ]; then
	echo "Usage: $0 [-pcf] [-snf] font_directory" 1>&2
	exit 1
fi
FONTDIR=${1}

if [ "$CMD" = convertfont ]; then
	convertfont -b -d "$FONTDIR" *.bdf
else
	for i in *.bdf; do
		j=`basename $i .bdf`
		cat $i | ${CMD} >${1}/${j}.${SUF}
	done
fi
