From b4920271ba414d1a91e2209f3b07c4506980ba3b Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Fri, 27 Aug 2004 00:34:15 +0000 Subject: [PATCH] Fixed new font format: necessity of offset table generation, output of fonts without one git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5018 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lib/gray_putsxy.c | 4 ++-- firmware/drivers/lcd-recorder.c | 3 ++- tools/convbdf.c | 13 ++++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/plugins/lib/gray_putsxy.c b/apps/plugins/lib/gray_putsxy.c index 906b0e1b38..9b34ad7a65 100644 --- a/apps/plugins/lib/gray_putsxy.c +++ b/apps/plugins/lib/gray_putsxy.c @@ -53,8 +53,8 @@ void gray_putsxy(int x, int y, const unsigned char *str) /* get proportional width and glyph bits */ width = pf->width ? pf->width[ch] : pf->maxwidth; - bits = pf->bits + (pf->offset ? pf->offset[ch] - : MULU16(pf->height, ch)); + bits = pf->bits + (pf->offset ? pf->offset[ch] : + MULU16((pf->height + 7) / 8, MULU16(pf->maxwidth, ch))); gray_drawbitmap((const unsigned char*) bits, x, y, width, pf->height, width); diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 584ead91dc..d2b0c4e6b1 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -408,7 +408,8 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) { unsigned int i; const unsigned char* bits = pf->bits + - (pf->offset ? pf->offset[ch] : (pf->height * ch)); + (pf->offset ? pf->offset[ch] + : ((pf->height + 7) / 8 * pf->maxwidth * ch)); if (ofs != 0) { diff --git a/tools/convbdf.c b/tools/convbdf.c index 14561869a2..16af43f3b8 100644 --- a/tools/convbdf.c +++ b/tools/convbdf.c @@ -393,7 +393,7 @@ int bdf_read_header(FILE *fp, struct font* pf) fprintf(stderr, "Error: bad 'ENCODING'\n"); return 0; } - if (encoding >= 0 && + if (encoding >= 0 && encoding <= limit_char && encoding >= start_char) { @@ -595,6 +595,16 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf) } /* determine whether font doesn't require encode table*/ +#ifdef ROTATE + l = 0; + for (i=0; isize; ++i) { + if (pf->offrot[i] != l) { + encodetable = 1; + break; + } + l += pf->maxwidth * (pf->height + 7) / 8; + } +#else l = 0; for (i=0; isize; ++i) { if (pf->offset[i] != l) { @@ -603,6 +613,7 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf) } l += BITMAP_WORDS(pf->width[i]) * pf->height; } +#endif if (!encodetable) { free(pf->offset); pf->offset = NULL;