2015-05-23 13:35:12 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
N=0
|
|
|
|
HEIGHT=16
|
|
|
|
FONTFILE="8x16graph.bdf"
|
|
|
|
|
|
|
|
(
|
2017-09-09 22:03:17 +02:00
|
|
|
echo -e "// newfont.h\\n"
|
2017-04-09 20:08:53 +02:00
|
|
|
echo -e "#ifndef FNEWFONT_H"
|
2017-09-09 22:03:17 +02:00
|
|
|
echo -e "#define FNEWFONT_H\\n"
|
2017-12-17 01:06:53 +01:00
|
|
|
echo -e "namespace fc\\n{"
|
2017-09-09 22:03:17 +02:00
|
|
|
echo -e "\\nstatic unsigned char __8x16graph[] =\\n{"
|
2015-05-23 13:35:12 +02:00
|
|
|
|
|
|
|
grep -A${HEIGHT} ^BITMAP "$FONTFILE" \
|
|
|
|
| tr '\n' ',' \
|
|
|
|
| sed -e 's/BITMAP,//g' \
|
|
|
|
| sed -e 's/--,/\n/g' \
|
2016-04-02 18:35:34 +02:00
|
|
|
| tr '[:upper:]' '[:lower:]' \
|
2015-05-23 13:35:12 +02:00
|
|
|
| sed -e 's/,/, /g' \
|
|
|
|
| sed -e 's/\([0-9a-f][0-9a-f]\)/0x\1/g' \
|
|
|
|
| sed -e 's/^0/ 0/g' \
|
|
|
|
| sed -e '$s/, $/ \n/' \
|
2016-04-02 18:35:34 +02:00
|
|
|
| while IFS=$'\n'; read -r LINE
|
2015-05-23 13:35:12 +02:00
|
|
|
do
|
|
|
|
echo "$LINE /* $N */"
|
2017-11-26 19:00:04 +01:00
|
|
|
(( N++ ))
|
2015-05-23 13:35:12 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
echo -e "};"
|
2017-12-17 01:06:53 +01:00
|
|
|
echo -e "\\n} // namespace fc"
|
2017-09-09 22:03:17 +02:00
|
|
|
echo -e "\\n#endif // FNEWFONT_H"
|
2015-05-23 13:35:12 +02:00
|
|
|
) > newfont.h
|
|
|
|
|