1 #!/bin/sh 2 3 THISDIR=`dirname "$0"` 4 DIRNAME=`readlink -f "$THISDIR/.."` 5 PROGNAME=`basename "$0"` 6 7 UNIFONT='/usr/share/unifont/unifont.hex' 8 9 if [ "$1" = '--help' ] ; then 10 cat 1>&2 <<EOF 11 Usage: $PROGNAME [ -q ] 12 13 Find font usage and generate the necessary binary font files. Currently, only 14 GNU Unifont is supported. 15 16 The optional -q argument indicates quiet execution, suppressing all output. 17 18 This script assumes that Unifont is installed in the following location: 19 20 $UNIFONT 21 22 The UNIFONT variable should be adjusted if this is not the case. 23 EOF 24 exit 1 25 fi 26 27 # Detect quiet operation. 28 29 if [ "$1" = '-q' ] ; then 30 QUIET="$1" 31 shift 1 32 else 33 QUIET= 34 fi 35 36 # Find all needed fonts and generate them. 37 38 for NEEDED in `find "$DIRNAME/pkg" -name '*.tff.needed'` ; do 39 TARGETDIR=`dirname "$NEEDED"` 40 FONTFILE=`basename "$NEEDED" .needed` 41 FONTNAME=`basename "$FONTFILE" .tff` 42 43 FONTPATH="$TARGETDIR/$FONTFILE" 44 45 if [ -e "$FONTPATH" ] ; then 46 if [ ! "$QUIET" ] ; then 47 echo "Exists, not generated: $FONTPATH" 1>&2 48 fi 49 continue 50 fi 51 52 if [ "$FONTNAME" != 'unifont' ] ; then 53 if [ ! "$QUIET" ] ; then 54 echo "Unrecognised ($FONTNAME), not generated: $FONTPATH" 1>&2 55 fi 56 continue 57 fi 58 59 if [ ! "$QUIET" ] ; then 60 echo "$FONTPATH" 61 fi 62 63 if ! "$THISDIR/readfont.py" "$UNIFONT" "$FONTPATH" ; then 64 cat 1>&2 <<EOF 65 66 Font generation halted due to conversion problem. Please check the UNIFONT 67 variable in this script, located here: 68 69 $DIRNAME/$PROGNAME 70 EOF 71 exit 1 72 fi 73 74 done