3 # Copyright 2000 Peter Ganten
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 # Where the fnt2bdf utility resides
25 FC
=$HOME""/wine
/tools
/fnt2bdf
;
26 # which OEM_CHARSET to use
28 TARGET
=/usr
/X11R
6/lib
/X11
/fonts
/misc
;
29 BDFTOPCF
=/usr
/X11R
6/bin
/bdftopcf
;
35 echo "usage: "`basename $0`" [-q] [-c charset] [-t fontdir] [-b bdftopcf] [-f fnt2bdf]"
36 echo " [-p pattern] windir"
38 echo "this utility scans a directory and its subdirectories for bitmap-fonts"
39 echo "in Windows format, converts them to PCF-fons and installs them. If X"
40 echo "is running, the X fontpath is re-adjusted."
43 echo " -q quit operation."
44 echo " -c charset charset name for OEM_CHARSET fonts, default: $CHARSET"
45 echo " -t fontdir directory to install the converted fonts in. This"
46 echo " directory should be a known fontdirectory to X, default:"
48 echo " -b bdftopcf name of the program to call for bdf to pcf conversion,"
49 echo " default: $BDFTOPCF";
50 echo " -f fnt2bdf name of the program to call for winfont to bdf conversion,"
52 echo " -p pattern Shell-Pattern of the filenames to look for. By default, the"
53 echo " utility will look for the pattern "$PAT" (case insensitive)."
54 echo " windir base directory to search."
61 -c ) shift; if [ "$1" ]; then CHARSET
=$1; shift; else usage
; fi; ;;
62 -t ) shift; if [ "$1" ]; then TARGET
=$1; shift; else usage
; fi; ;;
63 -b ) shift; if [ "$1" ]; then BDFTOPCF
=$1; shift; else usage
; fi; ;;
64 -f ) shift; if [ "$1" ]; then FC
=$1; shift; else usage
; fi; ;;
65 -p ) shift; if [ "$1" ]; then PAT
=$1; shift; else usage
; fi; ;;
68 * ) if [ "$WIND" ]; then usage
; else WIND
=$1; shift; fi; ;;
72 if [ ! "$WIND" ]; then usage
; fi;
73 if [ ! -d "$WIND" ]; then $Q echo "$WIND is not a directory"; exit 1; fi;
74 if [ ! -d "$TARGET" ]; then $Q echo "$TARGET is not a directory"; exit 1; fi;
75 type -p $BDFTOPCF 1>/dev
/null ||
{ $Q echo "Can 't execute $BDFTOPCF"; exit 1; }
76 type -p $FC 1>/dev
/null ||
{ $Q echo "Can't execute $FC"; exit 1; }
78 $Q echo -n "looking for bitmap fonts... "
79 FONTS
=`find "$WIND" -iname $PAT 1>$TFILE 2>/dev/null`;
81 $Q echo "$PAT is a invalid sarch expression"; exit 1;
84 { while read dummy
; do FONTS
[$i]="$dummy"; i
=$
[$i+1]; done; } < $TFILE
88 if [ -z "$FONTS" ]; then $Q echo "Can't find any fonts in $WIND"; exit 1; fi;
93 for i
in "${FONTS[@]}"; do
94 FNT
=`basename "$i"`; FNT
=${FNT%.???};
95 $Q echo "converting $i";
97 $FC -c $CHARSET -f $FNT "$i" 2>/dev
/null
;
99 $FC -c $CHARSET -f $FNT "$i";
104 if [ "$i" == "*.bdf" ]; then echo "No fonts extracted"; exit 0; fi;
105 bdftopcf
-o "${i%.???}.pcf" "$i";
106 $Q echo "installing ${i%.???}.pcf";
107 mv "${i%.???}.pcf" $TARGET 2>/dev
/null
108 if [ $?
-ne 0 ]; then
109 $Q echo "Can't install fonts to $TARGET. Are your root?"; cd "$OLDPWD"; rm -rf "$TMPDIR"; exit 1; fi;
114 $Q echo "running mkfontdir";
116 mkfontdir
1>/dev
/null
2>/dev
/null
;
122 if [ "$DISPLAY" ]; then $Q echo "adjusting X font database"; xset fp rehash
; fi;