7 # Where the fnt2bdf utility resides
8 FC
=$HOME""/wine
/tools
/fnt2bdf
;
9 # which OEM_CHARSET to use
11 TARGET
=/usr
/X11R
6/lib
/X11
/fonts
/misc
;
12 BDFTOPCF
=/usr
/X11R
6/bin
/bdftopcf
;
18 echo "usage: "`basename $0`" [-q] [-c charset] [-t fontdir] [-b bdftopcf] [-f fnt2bdf]"
19 echo " [-p pattern] windir"
21 echo "this utility scans a directory and its subdirectories for bitmap-fonts"
22 echo "in Windows format, converts them to PCF-fons and installs them. If X"
23 echo "is running, the X fontpath is re-adjusted."
26 echo " -q quit operation."
27 echo " -c charset charset name for OEM_CHARSET fonts, default: $CHARSET"
28 echo " -t fontdir directory to install the converted fonts in. This"
29 echo " directory should be a known fontdirectory to X, default:"
31 echo " -b bdftopcf name of the program to call for bdf to pcf conversion,"
32 echo " default: $BDFTOPCF";
33 echo " -f fnt2bdf name of the program to call for winfont to bdf conversion,"
35 echo " -p pattern Shell-Pattern of the filenames to look for. By default, the"
36 echo " utility will look for the pattern "$PAT" (case insensitive)."
37 echo " windir base directory to search."
44 -c ) shift; if [ "$1" ]; then CHARSET
=$1; shift; else usage
; fi; ;;
45 -t ) shift; if [ "$1" ]; then TARGET
=$1; shift; else usage
; fi; ;;
46 -b ) shift; if [ "$1" ]; then BDFTOPCF
=$1; shift; else usage
; fi; ;;
47 -f ) shift; if [ "$1" ]; then FC
=$1; shift; else usage
; fi; ;;
48 -p ) shift; if [ "$1" ]; then PAT
=$1; shift; else usage
; fi; ;;
51 * ) if [ "$WIND" ]; then usage
; else WIND
=$1; shift; fi; ;;
55 if [ ! "$WIND" ]; then usage
; fi;
56 if [ ! -d "$WIND" ]; then $Q echo "$WIND is not a directory"; exit 1; fi;
57 if [ ! -d "$TARGET" ]; then $Q echo "$TARGET is not a directory"; exit 1; fi;
58 type -p $BDFTOPCF 1>/dev
/null ||
{ $Q echo "Can 't execute $BDFTOPCF"; exit 1; }
59 type -p $FC 1>/dev
/null ||
{ $Q echo "Can't execute $FC"; exit 1; }
61 $Q echo -n "looking for bitmap fonts... "
62 FONTS
=`find "$WIND" -iname $PAT 1>$TFILE 2>/dev/null`;
64 $Q echo "$PAT is a invalid sarch expression"; exit 1;
67 { while read dummy
; do FONTS
[$i]="$dummy"; i
=$
[$i+1]; done; } < $TFILE
71 if [ -z "$FONTS" ]; then $Q echo "Can't find any fonts in $WIND"; exit 1; fi;
76 for i
in "${FONTS[@]}"; do
77 FNT
=`basename "$i"`; FNT
=${FNT%.???};
78 $Q echo "converting $i";
80 $FC -c $CHARSET -f $FNT "$i" 2>/dev
/null
;
82 $FC -c $CHARSET -f $FNT "$i";
87 if [ "$i" == "*.bdf" ]; then echo "No fonts extracted"; exit 0; fi;
88 bdftopcf
-o "${i%.???}.pcf" "$i";
89 $Q echo "installing ${i%.???}.pcf";
90 mv "${i%.???}.pcf" $TARGET 2>/dev
/null
92 $Q echo "Can't install fonts to $TARGET. Are your root?"; cd $OLDPWD; rm -rf $TMPDIR; exit 1; fi;
97 $Q echo "running mkfontdir";
99 mkfontdir
1>/dev
/null
2>/dev
/null
;
105 if [ "$DISPLAY" ]; then $Q echo "adjusting X font database"; xset fp rehash
; fi;