Fix libkeymap.pc installation
[platform/upstream/kbd.git] / contrib / font2psf
1 #!/bin/bash
2 #written by Martin Lohner, SuSE GmbH, Dec 1998
3 echo "This script converts 256 character font to psf-fonts"
4 echo "It simply assumes that all files in the current directory"
5 echo "that have a size of (256*n) are fontfiles of 8xn pixel" 
6 echo "fonts. If there are 512 character, non-psf-fonts you will"
7 echo "recognise this soon... Anyway, the setfont program isn´t"
8 echo "aware of this type of fonts, too. So there shouln´d be to"
9 echo "much of theese around."
10 echo "This script cares for font highs of 6,8,10,12,14,16 and 19" 
11 echo "pixels"
12 echo ""
13 echo -n "Start converting now? (Old file will not be touched) (Y/N)"
14 read a
15 random=hfdsvnpoh97k
16 if [ $a = y   -o $a = Y ] ; then
17         echo "Creating psf-headers..."
18         echo -ne "\066" > $random
19         echo -ne "\004" >> $random
20         echo -ne "\000" >> $random
21
22         
23         echo -ne "\006" > $random.6.tmp
24         cat $random $random.6.tmp > $random.6
25         echo -ne "\010" > $random.8.tmp
26         cat $random $random.8.tmp > $random.8
27         echo -ne "\012" > $random.10.tmp
28         cat $random $random.10.tmp > $random.10
29         echo -ne "\014" > $random.12.tmp
30         cat $random $random.12.tmp > $random.12
31         echo -ne "\016" > $random.14.tmp
32         cat $random $random.14.tmp > $random.14
33         echo -ne "\020" > $random.16.tmp
34         cat $random $random.16.tmp > $random.16
35         echo -ne "\023" > $random.19.tmp
36         cat $random $random.19.tmp > $random.19
37         
38         for i in 6 8 10 12 14 16 19; do
39         echo "Looking for 8x"$i"-fonts..."
40                 for j in `find . -maxdepth 1 -type f -size $((i*=256))c`;
41                 do
42                 cat $random.$i $j > $j.psf
43                 done
44         done
45         rm $random.*     
46 else
47         exit 1
48 fi