|
Packit Service |
50ad14 |
#!/bin/sh
|
|
Packit Service |
50ad14 |
# (c) Ricardas Cepas <rch@pub.osf.lt>. Copying policy: GNU GPL V2.
|
|
Packit Service |
50ad14 |
set -o errexit
|
|
Packit Service |
50ad14 |
#set -x
|
|
Packit Service |
50ad14 |
if [ $# != 1 ]
|
|
Packit Service |
50ad14 |
then echo ' Usage: psfsplit <psf_bitmap_font_filename> '
|
|
Packit Service |
50ad14 |
exit
|
|
Packit Service |
50ad14 |
fi
|
|
Packit Service |
50ad14 |
if [ `hexdump -e '/2 "%X" ' -n2 $1 ` != "436" ]
|
|
Packit Service |
50ad14 |
then echo $1 -- non .psf file
|
|
Packit Service |
50ad14 |
exit
|
|
Packit Service |
50ad14 |
fi
|
|
Packit Service |
50ad14 |
size=`hexdump -e '/1 "%i" ' -n1 -s2 $1 `
|
|
Packit Service |
50ad14 |
size=$[ ($size % 2 + 1) * 256 ]
|
|
Packit Service |
50ad14 |
height=`hexdump -e '/1 "%i" ' -n1 -s3 $1 `
|
|
Packit Service |
50ad14 |
echo $size chars, height=$height
|
|
Packit Service |
50ad14 |
mkdir $1_
|
|
Packit Service |
50ad14 |
dd bs=4 count=1 if=$1 of=$1_/#psf_header &>/dev/null
|
|
Packit Service |
50ad14 |
i=0
|
|
Packit Service |
50ad14 |
while let $[ i < $size ]
|
|
Packit Service |
50ad14 |
do
|
|
Packit Service |
50ad14 |
dd bs=1 count=$height skip=$[ $i * $height + 4 ] if=$1 \
|
|
Packit Service |
50ad14 |
of=$1_/`printf "%.3x" $i` &>/dev/null
|
|
Packit Service |
50ad14 |
let i+=1
|
|
Packit Service |
50ad14 |
done
|
|
Packit Service |
50ad14 |
dd bs=1 skip=$[ $i * $height + 4 ] if=$1 of=$1_/map_tables &>/dev/null
|
|
Packit Service |
50ad14 |
|