From 5aeaed8affd68c47c2c401e43c9eedca0f78b5d9 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Tue, 9 Aug 2005 23:05:35 +0000 Subject: [PATCH] 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 --- tools/convbdf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/convbdf.c b/tools/convbdf.c index 0bb2d07c44..d38790b285 100644 --- a/tools/convbdf.c +++ b/tools/convbdf.c @@ -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; } }