summaryrefslogtreecommitdiffstats
path: root/tools/bdf2fnt
blob: 2793d11764594f2029d1680cf2d6d1560603c15f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
#
# bdf2fnt - shell script to convert a BDF file to RBF format
#
# usage: bdf2fnt bdffile   (don't use .bdf extension!)
#
# Example: bdf2fnt courB08
#	creates ./courB08.fnt and /tmp/courB08.c
#	the .fnt file can be renamed /system.fnt for loading
#	the .c file can be moved to firmware dir to compile-in font
#

# convert from bdf to C source
./bdf2c $1.bdf > /tmp/$1.c

# compile writerbf with linked C source font
gcc -DARCHOS_RECORDER -DFONT=font_$1 -I../firmware -I../firmware/common -o /tmp/writerbf writerbf.c /tmp/$1.c

# run writerbf, will write linked incore font to .rbf format
/tmp/writerbf
rm /tmp/writerbf

# load .rbf font and display it for test
gcc -DARCHOS_RECORDER -DMAX_FONT_SIZE=500000 -I../firmware/common -o /tmp/loadrbf loadrbf.c
/tmp/loadrbf $1.fnt > /tmp/$1.1
rm /tmp/loadrbf

# link .c font and diff with .fnt load for test
gcc -DARCHOS_RECORDER -DFONT=font_$1 -I../firmware -I../firmware/common -o /tmp/loadrbf loadrbf.c /tmp/$1.c
/tmp/loadrbf > /tmp/$1.2
rm /tmp/loadrbf

#
# we diff the output to ensure correctness
diff /tmp/$1.1 /tmp/$1.2

# clean up
rm /tmp/$1.1 /tmp/$1.2
#rm /tmp/$1.c