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
This commit is contained in:
Jens Arnold 2004-08-27 00:34:15 +00:00
parent ac84357fa5
commit b4920271ba
3 changed files with 16 additions and 4 deletions

View file

@ -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);

View file

@ -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)
{

View file

@ -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; i<pf->size; ++i) {
if (pf->offrot[i] != l) {
encodetable = 1;
break;
}
l += pf->maxwidth * (pf->height + 7) / 8;
}
#else
l = 0;
for (i=0; i<pf->size; ++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;