summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlexander Levin <al.le@rockbox.org>2010-05-17 20:37:45 +0000
committerAlexander Levin <al.le@rockbox.org>2010-05-17 20:37:45 +0000
commit2ed7745ddefc084ca7030d48b251882e94fa2f9c (patch)
tree3f7f611f39cfbf9b85cb74c63c6857460b5c0d2e /tools
parentec6476c14adc83869862eef82fa3d4a25b971865 (diff)
downloadrockbox-2ed7745ddefc084ca7030d48b251882e94fa2f9c.tar.gz
rockbox-2ed7745ddefc084ca7030d48b251882e94fa2f9c.zip
Fix convbdf: now .c and .fnt files can be generated in one run again
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26115 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r--tools/convbdf.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/tools/convbdf.c b/tools/convbdf.c
index 91c33c8743..b8f7b1955f 100644
--- a/tools/convbdf.c
+++ b/tools/convbdf.c
@@ -424,11 +424,6 @@ int main(int ac, char **av)
exit(1);
}
- if (gen_c && gen_fnt) {
- print_info(".c and .fnt files can not be produced in the same run!\n");
- exit(1);
- }
-
if (oflag) {
if (ac > 1 || (gen_c && gen_fnt) || (gen_c && gen_h) || (gen_h && gen_fnt)) {
usage();
@@ -1329,10 +1324,9 @@ int gen_c_source(struct font* pf, char *path)
fprintf(ofp, "\n");
}
- /* update offrot since bits are now in sorted order */
- pf->offrot[i] = ofr;
- ofr += size;
-
+ /* update offrot since bits are now in sorted order */
+ pf->offrot[i] = ofr;
+ ofr += size;
}
#else
for (x=BITMAP_WORDS(width)*pf->height; x>0; --x) {
@@ -1352,15 +1346,17 @@ int gen_c_source(struct font* pf, char *path)
"static const unsigned short _sysfont_offset[] = {\n");
for (i=0; i<pf->size; ++i) {
- if (pf->offset[i] == -1) {
- pf->offset[i] = pf->offset[pf->defaultchar - pf->firstchar];
- pf->offrot[i] = pf->offrot[pf->defaultchar - pf->firstchar];
+ int offset = pf->offset[i];
+ int offrot = pf->offrot[i];
+ if (offset == -1) {
+ offset = pf->offset[pf->defaultchar - pf->firstchar];
+ offrot = pf->offrot[pf->defaultchar - pf->firstchar];
}
fprintf(ofp, " %d,\t/* (0x%02x) */\n",
#ifdef ROTATE
- pf->offrot[i], i+pf->firstchar);
+ offrot, i+pf->firstchar);
#else
- pf->offset[i], i+pf->firstchar);
+ offset, i+pf->firstchar);
#endif
}
fprintf(ofp, "};\n\n");
@@ -1602,13 +1598,14 @@ int gen_fnt_file(struct font* pf, char *path)
{
for (i=0; i<pf->size; ++i)
{
+ int offrot = pf->offrot[i];
if (pf->offset[i] == -1) {
- pf->offrot[i] = pf->offrot[pf->defaultchar - pf->firstchar];
+ offrot = pf->offrot[pf->defaultchar - pf->firstchar];
}
if ( pf->bits_size < 0xFFDB )
- writeshort(ofp, pf->offrot[i]);
+ writeshort(ofp, offrot);
else
- writeint(ofp, pf->offrot[i]);
+ writeint(ofp, offrot);
}
}
@@ -1623,10 +1620,11 @@ int gen_fnt_file(struct font* pf, char *path)
if (pf->offset)
for (i=0; i<pf->size; ++i) {
- if (pf->offset[i] == -1) {
- pf->offset[i] = pf->offset[pf->defaultchar - pf->firstchar];
+ int offset = pf->offset[i];
+ if (offset == -1) {
+ offset = pf->offset[pf->defaultchar - pf->firstchar];
}
- writeint(ofp, pf->offset[i]);
+ writeint(ofp, offset);
}
if (pf->width)