summaryrefslogtreecommitdiff
path: root/root
authorkergoth <kergoth>2003-04-23 19:22:49 (UTC)
committer kergoth <kergoth>2003-04-23 19:22:49 (UTC)
commite42cddcf7c6c97801eef357e009e0d37ebb6a3a4 (patch) (unidiff)
treef7f24942cebeccb41662165c36ef75396bbd1938 /root
parentf99c8e576030a7e8e83aa850b09ec69cc6217bb1 (diff)
downloadopie-e42cddcf7c6c97801eef357e009e0d37ebb6a3a4.zip
opie-e42cddcf7c6c97801eef357e009e0d37ebb6a3a4.tar.gz
opie-e42cddcf7c6c97801eef357e009e0d37ebb6a3a4.tar.bz2
Move update-qtfontdir somewhere a bit more appropriate
Diffstat (limited to 'root') (more/less context) (ignore whitespace changes)
-rwxr-xr-xroot/usr/sbin/update-qtfontdir62
1 files changed, 62 insertions, 0 deletions
diff --git a/root/usr/sbin/update-qtfontdir b/root/usr/sbin/update-qtfontdir
new file mode 100755
index 0000000..6df7b50
--- a/dev/null
+++ b/root/usr/sbin/update-qtfontdir
@@ -0,0 +1,62 @@
1#!/bin/sh
2
3usage()
4{
5 echo "usage: $0 [font directory, defaults to QTDIR/lib/fonts]"
6 exit 1
7}
8
9setVar()
10{
11 eval "$1='$2'"
12}
13
14getVar()
15{
16 eval "echo \$$1"
17}
18
19handleQPF()
20{
21 base=`basename $1`
22 family=`echo $base|cut -d_ -f1`
23 pt=`echo $base|cut -d_ -f2`
24 weight=`echo $base|cut -d_ -f3|sed -e 's,i$,,'`
25 if (echo $base|cut -d_ -f3|grep -q 'i$'); then
26 italic="y"
27 else
28 italic="n"
29 fi
30 echo "$family $base.qpf QPF $italic $weight $pt u"
31}
32
33if [ -z "$1" ]; then
34 if [ -n "$QTDIR" ]; then
35 fontdir=$QTDIR/lib/fonts
36 else
37 fontdir=/opt/QtPalmtop/lib/fonts
38 fi
39else
40 fontdir=$1
41fi
42
43if ! [ -d $fontdir ]; then
44 echo Error: $fontdir not a directory
45 exit 1
46fi
47
48if [ -e $fontdir/fontdir ]; then
49 cat $fontdir/fontdir | grep -v '\.qpf' > $fontdir/fontdir.new
50fi
51
52(
53 for file in `ls $fontdir/*.qpf|sed -e's,\.qpf$,,; s,_t[^_]*$,,;'|sort -u`; do
54 handleQPF $file
55 done
56) >> $fontdir/fontdir.new
57
58mv $fontdir/fontdir.new $fontdir/fontdir
59
60exit 0
61
62# vim:ai:et:sts=4:sw=4:tw=0: