1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-05 22:43:24 +00:00
freebsd-ports/vietnamese/vnterm/files/VNterm.sh.in

64 lines
1.1 KiB
Bash
Raw Normal View History

# ex:ts=4
# Modified from CXterm.sh included with the cxterm Chinese lang xterm pkg
# ENCODE_FONTS: automaticially search for a font from the list
#Files: "vn-r14 vn10x20 vn9x15 vnlutRS18"
VN_FONTS="vn-r14 vn10x20 viet vn-lucidasanstypewriter-18"
if [ "$BINDIR" != "" ]; then
VNTERM="$BINDIR/vnterm"
else
VNTERM=vnterm
fi
check_use_font ()
{
for f in "$@" ; do
if [ "`xlsfonts $f 2>/dev/null`" = "$f" ]; then
echo $f
return 0
fi
done
xset fp+ "$XFONTDIR"
for f in "$@" ; do
if [ "`xlsfonts $f 2>/dev/null`" = "$f" ]; then
echo $f
return 0
fi
done
return 1
}
1996-12-10 09:42:24 +00:00
VF=""
FN=0
for i in "$@" ; do
1996-12-10 09:42:24 +00:00
if [ "$i" = "-fn" ]; then
FN=1; continue;
fi
1996-12-10 09:42:24 +00:00
if [ "$FN" -eq 1 ]; then
VF=`check_use_font $i`
if [ "$VF" = "" ]; then
echo "Specified font doesn't exist in the X Window system."
exit 1
fi
break
fi
1996-12-10 09:42:24 +00:00
FN=0
done
1996-12-10 09:42:24 +00:00
if [ "$VF" = "" ]; then
VF=`check_use_font $VN_FONTS`
if [ "$VF" = "" ]; then
echo "Cannot identify a Vietnamese font in the X Window system."
exit 1
fi
1996-12-10 09:42:24 +00:00
FN_OPT="-fn $VF"
fi
XENVIRONMENT=$VNTERM_AD
export XENVIRONMENT
1996-12-10 09:42:24 +00:00
exec $VNTERM $FN_OPT $*