fontconfig/setfontdirs

37 lines
621 B
Bash
Executable File

#!/bin/sh
#
# $XFree86: xc/lib/fontconfig/setfontdirs,v 1.5 2002/12/17 03:26:36 dawes Exp $
#
LC_ALL=C
export LC_ALL
FONTDIRS=fontdirs$$
trap "rm $FONTDIRS" 0
sh ./findfonts ${1+"$@"} > $FONTDIRS
cp fonts.conf.in fonts.conf
chmod +w fonts.conf
EDITOR=ed
(echo q | ed) > /dev/null 2>&1
if [ $? -ne 0 ]; then
EDITOR=ex
(echo q | ex) > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "$0: *** Error: Cannot find 'ed' or 'ex' editor"
exit 1
fi
fi
$EDITOR fonts.conf << EOF
/FONTPATH_END/a
<!-- Font directory list configured on `date` -->
.
+r $FONTDIRS
a
<dir>~/.fonts</dir>
.
/FONTPATH_START/,/FONTPATH_END/d
w
q
EOF