*** empty log message ***
[h316.git] / pc-tools / fontgen / data / gen.sh
1 #!/bin/bash
2
3 IFS="
4 "
5 cat <<EOF
6 #include <stdio.h>
7 #include "fontgen.h"
8
9 EOF
10
11 glyphs=
12 no_glyphs=0
13 cont=1
14
15 while [ $cont == 1 ] ; do
16 if ! line=`line`; then cont=0; fi
17 number=$((`echo $line | cut -b 1-5`))
18 echo proc: $number 1>&2
19 size=$((`echo $line | cut -b 6-8`))
20 # echo "-$number-$size-"
21 plabel="points_$number"
22 echo "static pl_point $plabel[]={"
23 i=0
24 while [ $i -lt $size ]; do
25 c1=`echo $line | cut -b $((9+$i*2))| sed 's/\\\\/\\\\\\\\/g'`
26 c2=`echo $line | cut -b $((10+$i*2))| sed 's/\\\\/\\\\\\\\/g'`
27
28 echo -n " {.p_data=(((int)'$c1')<<8)+('$c2')}"
29 if [ $i -lt $(($size-1)) ]; then
30 echo ","
31 fi
32 i=$(($i+1))
33 done
34 echo -e "\n };"
35
36 glyphs+=`echo -e "\n{.gl_size=$size,.gl_points=$plabel,.gl_number=$number}"`
37 no_glyphs=$(($no_glyphs+1))
38 done
39
40 echo -e "\n\npl_glyph hershey_glyphs[]={"
41 g=0
42 for n in $glyphs; do
43 g=$(($g+1))
44 echo -n " $n"
45 if [ $g -eq $(($no_glyphs)) ]; then
46 echo
47 else
48 echo ","
49 fi
50 done
51 echo " };"
52 echo -e "\n\n"
53
54 echo "pl_font hershey_fonts={"
55 echo " .f_label=\"HERSHY\","
56 echo " .f_size=$no_glyphs,"
57 echo " .f_glyphs=hershey_glyphs"
58 echo " };"
59
60
61 echo -e "\n/* End. */"