File: font.sh

package info (click to toggle)
fim 0.5~rc2-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,240 kB
  • ctags: 3,308
  • sloc: cpp: 25,233; ansic: 4,390; sh: 1,306; makefile: 398; perl: 189; exp: 25; awk: 9
file content (49 lines) | stat: -rwxr-xr-x 1,250 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

# tests font functionality in fim
# this script shall work whatever its configure options (even if fim was compiled 'dumb')

f=src/fim 
if test x != "$top_srcdir"; then true ; else top_srcdir=./ ; fi
ff="$top_srcdir/media/fim.png media/icon_smile.gif"
fa="-c quit $ff "
fv="-V "

fail()
{
	echo "[!] $@";
	exit -1;
}

resign()
{
	echo "[~] $@";
	exit 0;
}
succeed()
{
	echo "[*] $@";
	exit 0;
}

which grep || fail "we don't go anywhere without grep in our pocket"
g="`which grep` -i"

export FBFONT=''
e='s/^.*://g'

POD='\(sdl\|fb\|imlib2\)'
$f $fv 2>&1 | $g -i 'supported output devices.*:' | $g "$POD"|| resign "missing a pixel oriented driver (as one of $POD)"
$f $fv 2>&1 | $g 'supported file formats:'   | $g '\(png\|gif\)' | resign "missing adequate file format support"

export FBFONT=/dev/null
if $f $fa ; then fail "$f $fa does not fail as it should on wrong font file" ; 
else echo "$f $fa correctly recognizes an invalid FBFONT variable and exits" ; fi

export FBFONT=$top_srcdir/var/fonts/Lat15-Terminus16.psf
if ! $f $fa ; then fail "$f $fa fails, but it should not, as a correct font was provided" ; 
else echo "$f $fa correctly recognizes a valid font file" ; fi

succeed "Font environment variables check PASSED"
exit 0