#!/bin/sh

# Make a trial run of a font 'ourfont.bdf'

compress=gzip
suffix=gz

#compress=compress
#suffix=Z


# First, make BDF source


ourfont="ourfont"	# Name of the font we are working on
tryfont="tmp"
sampleapp="wish ./tknotepad1 test_koi8c.txt"

[ -r $1 ] || {
	echo Cannot read font file $1. Exiting...
	exit 1;
}

rm -f $ourfont.bdf
ln -s $1 $ourfont.bdf

# Output is ourfont-KOI8-C.bdf
# Now compile it.
mkdir -p $tryfont
bdftopcf $ourfont.bdf | $compress > $tryfont/$ourfont.pcf.$suffix
cd $tryfont
mkfontdir
# Make a sensible alias. "fonts.dir" contains only one font name.
echo trialfont-koi8-c `tail -1 fonts.dir | cut -d' ' -f2` > fonts.alias
cd ..

# Refresh X server.

xset +fp `pwd`/$tryfont
xset fp rehash

# Start sample application

$sampleapp

#Clean up
xset -fp `pwd`/$tryfont
rm -rf `pwd`/$tryfont $ourfont.bdf
