finalcut/src/fonts/font2c.sh

29 lines
529 B
Bash
Raw Normal View History

2015-05-23 13:35:12 +02:00
#!/bin/bash
N=0
HEIGHT=16
FONTFILE="8x16std"
(
echo -e "// vgafont.h\n"
echo -e "#ifndef _FVGAFONT_H"
echo -e "#define _FVGAFONT_H\n"
xxd -g 1 -i -c $HEIGHT $FONTFILE \
| sed -e 's/ {$/\n{/' \
| sed -e 's/^unsigned/static unsigned/' \
| sed -e '/len = /d' \
| while IFS=$'\n'; read LINE
do
if [ "${LINE:0:1}" != " " ]
then
echo "$LINE"
else
echo "$LINE /* $N */" | sed -e 's/\([0-9]\) \/\*/\1 \/*/'
let N++
fi
done
echo -e "\n#endif // _FVGAFONT_H"
) > vgafont.h