summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-08-27 00:34:15 +0000
committerJens Arnold <amiconn@rockbox.org>2004-08-27 00:34:15 +0000
commitb4920271ba414d1a91e2209f3b07c4506980ba3b (patch)
tree4ab165989ab2b62167ad2479189128cd7466b245
parentac84357fa59718f5f9e63a1e219673ca861e7998 (diff)
downloadrockbox-b4920271ba414d1a91e2209f3b07c4506980ba3b.tar.gz
rockbox-b4920271ba414d1a91e2209f3b07c4506980ba3b.zip
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
-rw-r--r--apps/plugins/lib/gray_putsxy.c4
-rw-r--r--firmware/drivers/lcd-recorder.c3
-rw-r--r--tools/convbdf.c13
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)
53 53
54 /* get proportional width and glyph bits */ 54 /* get proportional width and glyph bits */
55 width = pf->width ? pf->width[ch] : pf->maxwidth; 55 width = pf->width ? pf->width[ch] : pf->maxwidth;
56 bits = pf->bits + (pf->offset ? pf->offset[ch] 56 bits = pf->bits + (pf->offset ? pf->offset[ch] :
57 : MULU16(pf->height, ch)); 57 MULU16((pf->height + 7) / 8, MULU16(pf->maxwidth, ch)));
58 58
59 gray_drawbitmap((const unsigned char*) bits, x, y, width, pf->height, 59 gray_drawbitmap((const unsigned char*) bits, x, y, width, pf->height,
60 width); 60 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)
408 { 408 {
409 unsigned int i; 409 unsigned int i;
410 const unsigned char* bits = pf->bits + 410 const unsigned char* bits = pf->bits +
411 (pf->offset ? pf->offset[ch] : (pf->height * ch)); 411 (pf->offset ? pf->offset[ch]
412 : ((pf->height + 7) / 8 * pf->maxwidth * ch));
412 413
413 if (ofs != 0) 414 if (ofs != 0)
414 { 415 {
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)
393 fprintf(stderr, "Error: bad 'ENCODING'\n"); 393 fprintf(stderr, "Error: bad 'ENCODING'\n");
394 return 0; 394 return 0;
395 } 395 }
396 if (encoding >= 0 && 396 if (encoding >= 0 &&
397 encoding <= limit_char && 397 encoding <= limit_char &&
398 encoding >= start_char) { 398 encoding >= start_char) {
399 399
@@ -595,6 +595,16 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
595 } 595 }
596 596
597 /* determine whether font doesn't require encode table*/ 597 /* determine whether font doesn't require encode table*/
598#ifdef ROTATE
599 l = 0;
600 for (i=0; i<pf->size; ++i) {
601 if (pf->offrot[i] != l) {
602 encodetable = 1;
603 break;
604 }
605 l += pf->maxwidth * (pf->height + 7) / 8;
606 }
607#else
598 l = 0; 608 l = 0;
599 for (i=0; i<pf->size; ++i) { 609 for (i=0; i<pf->size; ++i) {
600 if (pf->offset[i] != l) { 610 if (pf->offset[i] != l) {
@@ -603,6 +613,7 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
603 } 613 }
604 l += BITMAP_WORDS(pf->width[i]) * pf->height; 614 l += BITMAP_WORDS(pf->width[i]) * pf->height;
605 } 615 }
616#endif
606 if (!encodetable) { 617 if (!encodetable) {
607 free(pf->offset); 618 free(pf->offset);
608 pf->offset = NULL; 619 pf->offset = NULL;