convbdf: fixed a problem with 16 pixel wide characters. It now also refuses to convert fonts with >16 pixel characters, since it can't yet convert them correctly (bitmap_t is 16 bits wide).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7295 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2005-08-09 23:05:35 +00:00
parent 4f6df497ff
commit 5aeaed8aff

View file

@ -528,6 +528,11 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
maxwidth = width;
pf->width[encoding-pf->firstchar] = width;
if(maxwidth > 16) {
fprintf(stderr, "Error: Too wide characters (>16 pixels)\n");
return 0;
}
/* clear bitmap*/
memset(ch_bitmap, 0, BITMAP_BYTES(width) * pf->height);
@ -743,8 +748,7 @@ int rotleft(unsigned char *dst, bitmap_t *src, unsigned int width,
src_mask >>= 1; /* next input bit */
if (src_mask == 0) /* input word done? */
{
src_mask = 1 << (sizeof (bitmap_t) * 8 - 1);
i++; /* next input word */
continue;
}
}