lib/Tools/installfonts
changeset 12478 ff7e534367b5
parent 12477 8f5e0a335ca7
child 12479 ed46612ad7ec
equal deleted inserted replaced
12477:8f5e0a335ca7 12478:ff7e534367b5
     1 #!/usr/bin/env bash
       
     2 #
       
     3 # $Id$
       
     4 # Author: Markus Wenzel, TU Muenchen
       
     5 # License: GPL (GNU GENERAL PUBLIC LICENSE)
       
     6 #
       
     7 # DESCRIPTION: install symbol fonts on the current X11 server
       
     8 
       
     9 
       
    10 PRG="$(basename "$0")"
       
    11 
       
    12 function usage()
       
    13 {
       
    14   echo
       
    15   echo "Usage: $PRG [OPTIONS]"
       
    16   echo
       
    17   echo "  Options are:"
       
    18   echo "    -x           install X-Symbol fonts"
       
    19   echo
       
    20   echo "  Install symbol fonts on the current X11 server."
       
    21   echo
       
    22   exit 1
       
    23 }
       
    24 
       
    25 
       
    26 ## process command line
       
    27 
       
    28 # options
       
    29 
       
    30 XSYMB=""
       
    31 
       
    32 while getopts "x" OPT
       
    33 do
       
    34   case "$OPT" in
       
    35     x)
       
    36       XSYMB=true
       
    37       ;;
       
    38     \?)
       
    39       usage
       
    40       ;;
       
    41   esac
       
    42 done
       
    43 
       
    44 shift $(($OPTIND - 1))
       
    45 
       
    46 
       
    47 # args
       
    48 
       
    49 [ "$#" -ne 0 ] && usage
       
    50 
       
    51 
       
    52 ## check fonts
       
    53 
       
    54 function checkfonts()
       
    55 {
       
    56   RESULT=$(xlsfonts -fn "$1" 2>&1) || return 1
       
    57 
       
    58   case "$RESULT" in
       
    59     xlsfonts:*)
       
    60       return 1
       
    61       ;;
       
    62   esac
       
    63 
       
    64   return 0
       
    65 }
       
    66 
       
    67 
       
    68 ## main
       
    69 
       
    70 ISABELLE_PATTERN="-isabelle-fixed-*-isabelle-0"
       
    71 XSYMBOL_PATTERN="-xsymb-xsymb0-*"
       
    72 
       
    73 if [ -z "$XSYMB" ]; then
       
    74   checkfonts "$ISABELLE_PATTERN" || eval $ISABELLE_INSTALLFONTS
       
    75   checkfonts "$ISABELLE_PATTERN" || \
       
    76     echo "Warning: Isabelle fonts probably not installed correctly!" >&2
       
    77 else
       
    78   checkfonts "$XSYMBOL_PATTERN" || eval $XSYMBOL_INSTALLFONTS
       
    79   checkfonts "$XSYMBOL_PATTERN" || \
       
    80     echo "Warning: X-Symbol fonts probably not installed correctly!" >&2
       
    81 fi