summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlexander Levin <al.le@rockbox.org>2009-03-05 23:06:00 +0000
committerAlexander Levin <al.le@rockbox.org>2009-03-05 23:06:00 +0000
commit2bbfd6f4ff2b650df94363400de97e9b7729defe (patch)
treeee1c583048ac4bae91c361002a71088ab7b6befa /tools
parentcf25649597a6af7374c3b6b178febfd161321757 (diff)
downloadrockbox-2bbfd6f4ff2b650df94363400de97e9b7729defe.tar.gz
rockbox-2bbfd6f4ff2b650df94363400de97e9b7729defe.tar.bz2
rockbox-2bbfd6f4ff2b650df94363400de97e9b7729defe.zip
Provide better stats (print the total number of glyphs as well)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20210 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r--tools/convbdf.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/convbdf.c b/tools/convbdf.c
index ce74d83e44..b566d2cd2e 100644
--- a/tools/convbdf.c
+++ b/tools/convbdf.c
@@ -40,14 +40,15 @@ struct font {
int height; /* height in pixels*/
int ascent; /* ascent (baseline) height*/
int firstchar; /* first character in bitmap*/
- int size; /* font size in glyphs*/
+ int size; /* font size in glyphs ('holes' included) */
bitmap_t* bits; /* 16-bit right-padded bitmap data*/
unsigned int* offset; /* offsets into bitmap data*/
unsigned char* width; /* character widths or NULL if fixed*/
int defaultchar; /* default char (not glyph index)*/
int bits_size; /* # words of bitmap_t bits*/
- /* unused by runtime system, read in by convbdf*/
+ /* unused by runtime system, read in by convbdf */
+ unsigned int nchars; /* number of different glyphs */
unsigned int* offrot; /* offsets into rotated bitmap data*/
char * name; /* font name*/
char * facename; /* facename of font*/
@@ -328,9 +329,10 @@ struct font* bdf_read_font(char *path)
}
if (pf->num_clipped > 0) {
- fprintf(stderr, "Warning: %d characters were clipped "
+ fprintf(stderr, "Warning: %d characters out of %u were clipped "
"(%d at ascent, %d at descent)\n",
- pf->num_clipped, pf->num_clipped_ascent, pf->num_clipped_descent);
+ pf->num_clipped, pf->nchars,
+ pf->num_clipped_ascent, pf->num_clipped_descent);
fprintf(stderr, " max overflows: ascent: %d, descent: %d\n",
pf->max_over_ascent, pf->max_over_descent);
}
@@ -348,7 +350,7 @@ struct font* bdf_read_font(char *path)
int bdf_read_header(FILE *fp, struct font* pf)
{
int encoding;
- int nchars, maxwidth;
+ int maxwidth;
int firstchar = 65535;
int lastchar = -1;
char buf[256];
@@ -410,7 +412,7 @@ int bdf_read_header(FILE *fp, struct font* pf)
continue;
}
if (isprefix(buf, "CHARS ")) {
- if (sscanf(buf, "CHARS %d", &nchars) != 1) {
+ if (sscanf(buf, "CHARS %u", &pf->nchars) != 1) {
fprintf(stderr, "Error: bad 'CHARS'\n");
return 0;
}
@@ -465,7 +467,7 @@ int bdf_read_header(FILE *fp, struct font* pf)
maxwidth = pf->fbbw;
/* initially use font maxwidth * height for bits allocation*/
- pf->bits_size = nchars * BITMAP_WORDS(maxwidth) * pf->height;
+ pf->bits_size = pf->nchars * BITMAP_WORDS(maxwidth) * pf->height;
/* allocate bits, offset, and width arrays*/
pf->bits = (bitmap_t *)malloc(pf->bits_size * sizeof(bitmap_t) + EXTRA);