Fix libkeymap.pc installation
[platform/upstream/kbd.git] / contrib / psfsplit
1 #!/bin/sh
2 # (c) Ricardas Cepas <rch@pub.osf.lt>. Copying policy: GNU GPL V2.
3 set -o errexit
4 #set -x
5 if [ $# != 1 ]
6 then    echo '  Usage: psfsplit <psf_bitmap_font_filename> '
7         exit
8 fi
9 if [ `hexdump -e '/2 "%X" ' -n2 $1 ` != "436" ]
10 then    echo $1 -- non .psf file
11         exit
12 fi
13 size=`hexdump -e '/1 "%i" ' -n1 -s2 $1 `
14 size=$[ ($size % 2 + 1) * 256 ]
15 height=`hexdump -e '/1 "%i" ' -n1 -s3 $1 `
16 echo $size chars, height=$height
17 mkdir $1_
18 dd bs=4 count=1 if=$1 of=$1_/#psf_header &>/dev/null
19 i=0
20 while let $[ i < $size ]
21 do
22         dd bs=1 count=$height skip=$[ $i * $height + 4 ] if=$1 \
23                 of=$1_/`printf "%.3x" $i` &>/dev/null
24         let i+=1
25 done
26 dd bs=1 skip=$[ $i * $height + 4 ] if=$1 of=$1_/map_tables &>/dev/null
27