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
This commit is contained in:
Alexander Levin 2010-05-17 20:37:45 +00:00
parent ec6476c14a
commit 2ed7745dde

View file

@ -424,11 +424,6 @@ int main(int ac, char **av)
exit(1); 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 (oflag) {
if (ac > 1 || (gen_c && gen_fnt) || (gen_c && gen_h) || (gen_h && gen_fnt)) { if (ac > 1 || (gen_c && gen_fnt) || (gen_c && gen_h) || (gen_h && gen_fnt)) {
usage(); usage();
@ -1332,7 +1327,6 @@ int gen_c_source(struct font* pf, char *path)
/* update offrot since bits are now in sorted order */ /* update offrot since bits are now in sorted order */
pf->offrot[i] = ofr; pf->offrot[i] = ofr;
ofr += size; ofr += size;
} }
#else #else
for (x=BITMAP_WORDS(width)*pf->height; x>0; --x) { 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"); "static const unsigned short _sysfont_offset[] = {\n");
for (i=0; i<pf->size; ++i) { for (i=0; i<pf->size; ++i) {
if (pf->offset[i] == -1) { int offset = pf->offset[i];
pf->offset[i] = pf->offset[pf->defaultchar - pf->firstchar]; int offrot = pf->offrot[i];
pf->offrot[i] = pf->offrot[pf->defaultchar - pf->firstchar]; if (offset == -1) {
offset = pf->offset[pf->defaultchar - pf->firstchar];
offrot = pf->offrot[pf->defaultchar - pf->firstchar];
} }
fprintf(ofp, " %d,\t/* (0x%02x) */\n", fprintf(ofp, " %d,\t/* (0x%02x) */\n",
#ifdef ROTATE #ifdef ROTATE
pf->offrot[i], i+pf->firstchar); offrot, i+pf->firstchar);
#else #else
pf->offset[i], i+pf->firstchar); offset, i+pf->firstchar);
#endif #endif
} }
fprintf(ofp, "};\n\n"); fprintf(ofp, "};\n\n");
@ -1602,13 +1598,14 @@ int gen_fnt_file(struct font* pf, char *path)
{ {
for (i=0; i<pf->size; ++i) for (i=0; i<pf->size; ++i)
{ {
int offrot = pf->offrot[i];
if (pf->offset[i] == -1) { 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 ) if ( pf->bits_size < 0xFFDB )
writeshort(ofp, pf->offrot[i]); writeshort(ofp, offrot);
else 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) if (pf->offset)
for (i=0; i<pf->size; ++i) { for (i=0; i<pf->size; ++i) {
if (pf->offset[i] == -1) { int offset = pf->offset[i];
pf->offset[i] = pf->offset[pf->defaultchar - pf->firstchar]; if (offset == -1) {
offset = pf->offset[pf->defaultchar - pf->firstchar];
} }
writeint(ofp, pf->offset[i]); writeint(ofp, offset);
} }
if (pf->width) if (pf->width)