summaryrefslogtreecommitdiffstats
path: root/vietnamese/vnterm/files/VNterm.sh.in
blob: 176aa74d3cb6d0d67179d430e668e28988249ba1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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
}


VF=""
FN=0
for i in "$@" ; do 
	if [ "$i" = "-fn" ]; then
		FN=1;  continue;
	fi
	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
	FN=0
done


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
	FN_OPT="-fn $VF"
fi

XENVIRONMENT=$VNTERM_AD
export XENVIRONMENT
exec $VNTERM $FN_OPT $*
OpenPOWER on IntegriCloud