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