Index: tools/convbdf.c =================================================================== --- tools/convbdf.c (Revision 20153) +++ tools/convbdf.c (Arbeitskopie) @@ -487,7 +487,11 @@ return 0; } if (isprefix(buf, "STARTCHAR")) { - encoding = width = bbw = bbh = bbx = bby = -1; + encoding = width = -1; + bbw = pf->fbbw; + bbh = pf->fbbh; + bbx = pf->fbbx; + bby = pf->fbby; continue; } if (isprefix(buf, "ENCODING ")) { @@ -519,6 +523,7 @@ if (strequal(buf, "BITMAP") || strequal(buf, "BITMAP ")) { bitmap_t *ch_bitmap = pf->bits + ofs; int ch_words; + int y; if (encoding < 0) continue; @@ -550,6 +555,19 @@ #define BM(row,col) (*(ch_bitmap + ((row)*ch_words) + (col))) #define BITMAP_NIBBLES (BITMAP_BITSPERIMAGE/4) + if (bby < -pf->descent) { + fprintf(stderr, "Warning: character %d goes %d pixel(s)" + " beyond the font's descent, it will be clipped\n", + encoding, -bby-pf->descent); + } + if (bby + bbh > pf->ascent) { + fprintf(stderr, "Warning: character %d goes %d pixel(s)" + " beyond the font's ascent, it will be clipped\n", + encoding, bby + bbh - pf->ascent); + } + + y = bby + bbh; /* 0-based y within the char */ + /* read bitmaps*/ for (i=0; ; ++i) { int hexnibbles; @@ -560,6 +578,12 @@ } if (isprefix(buf, "ENDCHAR")) break; + + y--; + if ((y >= pf->ascent) || (y < -pf->descent)) { + /* We're beyond the area that Rockbox can render -> clip */ + continue; + } hexnibbles = strlen(buf); for (k=0; k