diff options
author | Alexander Levin <al.le@rockbox.org> | 2010-05-17 20:37:45 +0000 |
---|---|---|
committer | Alexander Levin <al.le@rockbox.org> | 2010-05-17 20:37:45 +0000 |
commit | 2ed7745ddefc084ca7030d48b251882e94fa2f9c (patch) | |
tree | 3f7f611f39cfbf9b85cb74c63c6857460b5c0d2e | |
parent | ec6476c14adc83869862eef82fa3d4a25b971865 (diff) | |
download | rockbox-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
-rw-r--r-- | tools/convbdf.c | 38 |
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) | |||
424 | exit(1); | 424 | exit(1); |
425 | } | 425 | } |
426 | 426 | ||
427 | if (gen_c && gen_fnt) { | ||
428 | print_info(".c and .fnt files can not be produced in the same run!\n"); | ||
429 | exit(1); | ||
430 | } | ||
431 | |||
432 | if (oflag) { | 427 | if (oflag) { |
433 | if (ac > 1 || (gen_c && gen_fnt) || (gen_c && gen_h) || (gen_h && gen_fnt)) { | 428 | if (ac > 1 || (gen_c && gen_fnt) || (gen_c && gen_h) || (gen_h && gen_fnt)) { |
434 | usage(); | 429 | usage(); |
@@ -1329,10 +1324,9 @@ int gen_c_source(struct font* pf, char *path) | |||
1329 | fprintf(ofp, "\n"); | 1324 | fprintf(ofp, "\n"); |
1330 | } | 1325 | } |
1331 | 1326 | ||
1332 | /* update offrot since bits are now in sorted order */ | 1327 | /* update offrot since bits are now in sorted order */ |
1333 | pf->offrot[i] = ofr; | 1328 | pf->offrot[i] = ofr; |
1334 | ofr += size; | 1329 | ofr += size; |
1335 | |||
1336 | } | 1330 | } |
1337 | #else | 1331 | #else |
1338 | for (x=BITMAP_WORDS(width)*pf->height; x>0; --x) { | 1332 | for (x=BITMAP_WORDS(width)*pf->height; x>0; --x) { |
@@ -1352,15 +1346,17 @@ int gen_c_source(struct font* pf, char *path) | |||
1352 | "static const unsigned short _sysfont_offset[] = {\n"); | 1346 | "static const unsigned short _sysfont_offset[] = {\n"); |
1353 | 1347 | ||
1354 | for (i=0; i<pf->size; ++i) { | 1348 | for (i=0; i<pf->size; ++i) { |
1355 | if (pf->offset[i] == -1) { | 1349 | int offset = pf->offset[i]; |
1356 | pf->offset[i] = pf->offset[pf->defaultchar - pf->firstchar]; | 1350 | int offrot = pf->offrot[i]; |
1357 | pf->offrot[i] = pf->offrot[pf->defaultchar - pf->firstchar]; | 1351 | if (offset == -1) { |
1352 | offset = pf->offset[pf->defaultchar - pf->firstchar]; | ||
1353 | offrot = pf->offrot[pf->defaultchar - pf->firstchar]; | ||
1358 | } | 1354 | } |
1359 | fprintf(ofp, " %d,\t/* (0x%02x) */\n", | 1355 | fprintf(ofp, " %d,\t/* (0x%02x) */\n", |
1360 | #ifdef ROTATE | 1356 | #ifdef ROTATE |
1361 | pf->offrot[i], i+pf->firstchar); | 1357 | offrot, i+pf->firstchar); |
1362 | #else | 1358 | #else |
1363 | pf->offset[i], i+pf->firstchar); | 1359 | offset, i+pf->firstchar); |
1364 | #endif | 1360 | #endif |
1365 | } | 1361 | } |
1366 | fprintf(ofp, "};\n\n"); | 1362 | fprintf(ofp, "};\n\n"); |
@@ -1602,13 +1598,14 @@ int gen_fnt_file(struct font* pf, char *path) | |||
1602 | { | 1598 | { |
1603 | for (i=0; i<pf->size; ++i) | 1599 | for (i=0; i<pf->size; ++i) |
1604 | { | 1600 | { |
1601 | int offrot = pf->offrot[i]; | ||
1605 | if (pf->offset[i] == -1) { | 1602 | if (pf->offset[i] == -1) { |
1606 | pf->offrot[i] = pf->offrot[pf->defaultchar - pf->firstchar]; | 1603 | offrot = pf->offrot[pf->defaultchar - pf->firstchar]; |
1607 | } | 1604 | } |
1608 | if ( pf->bits_size < 0xFFDB ) | 1605 | if ( pf->bits_size < 0xFFDB ) |
1609 | writeshort(ofp, pf->offrot[i]); | 1606 | writeshort(ofp, offrot); |
1610 | else | 1607 | else |
1611 | writeint(ofp, pf->offrot[i]); | 1608 | writeint(ofp, offrot); |
1612 | } | 1609 | } |
1613 | } | 1610 | } |
1614 | 1611 | ||
@@ -1623,10 +1620,11 @@ int gen_fnt_file(struct font* pf, char *path) | |||
1623 | 1620 | ||
1624 | if (pf->offset) | 1621 | if (pf->offset) |
1625 | for (i=0; i<pf->size; ++i) { | 1622 | for (i=0; i<pf->size; ++i) { |
1626 | if (pf->offset[i] == -1) { | 1623 | int offset = pf->offset[i]; |
1627 | pf->offset[i] = pf->offset[pf->defaultchar - pf->firstchar]; | 1624 | if (offset == -1) { |
1625 | offset = pf->offset[pf->defaultchar - pf->firstchar]; | ||
1628 | } | 1626 | } |
1629 | writeint(ofp, pf->offset[i]); | 1627 | writeint(ofp, offset); |
1630 | } | 1628 | } |
1631 | 1629 | ||
1632 | if (pf->width) | 1630 | if (pf->width) |