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