diff options
author | Alexander Levin <al.le@rockbox.org> | 2009-03-05 23:06:00 +0000 |
---|---|---|
committer | Alexander Levin <al.le@rockbox.org> | 2009-03-05 23:06:00 +0000 |
commit | 2bbfd6f4ff2b650df94363400de97e9b7729defe (patch) | |
tree | ee1c583048ac4bae91c361002a71088ab7b6befa /tools | |
parent | cf25649597a6af7374c3b6b178febfd161321757 (diff) | |
download | rockbox-2bbfd6f4ff2b650df94363400de97e9b7729defe.tar.gz 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.c | 16 |
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 { | |||
40 | int height; /* height in pixels*/ | 40 | int height; /* height in pixels*/ |
41 | int ascent; /* ascent (baseline) height*/ | 41 | int ascent; /* ascent (baseline) height*/ |
42 | int firstchar; /* first character in bitmap*/ | 42 | int firstchar; /* first character in bitmap*/ |
43 | int size; /* font size in glyphs*/ | 43 | int size; /* font size in glyphs ('holes' included) */ |
44 | bitmap_t* bits; /* 16-bit right-padded bitmap data*/ | 44 | bitmap_t* bits; /* 16-bit right-padded bitmap data*/ |
45 | unsigned int* offset; /* offsets into bitmap data*/ | 45 | unsigned int* offset; /* offsets into bitmap data*/ |
46 | unsigned char* width; /* character widths or NULL if fixed*/ | 46 | unsigned char* width; /* character widths or NULL if fixed*/ |
47 | int defaultchar; /* default char (not glyph index)*/ | 47 | int defaultchar; /* default char (not glyph index)*/ |
48 | int bits_size; /* # words of bitmap_t bits*/ | 48 | int bits_size; /* # words of bitmap_t bits*/ |
49 | 49 | ||
50 | /* unused by runtime system, read in by convbdf*/ | 50 | /* unused by runtime system, read in by convbdf */ |
51 | unsigned int nchars; /* number of different glyphs */ | ||
51 | unsigned int* offrot; /* offsets into rotated bitmap data*/ | 52 | unsigned int* offrot; /* offsets into rotated bitmap data*/ |
52 | char * name; /* font name*/ | 53 | char * name; /* font name*/ |
53 | char * facename; /* facename of font*/ | 54 | char * facename; /* facename of font*/ |
@@ -328,9 +329,10 @@ struct font* bdf_read_font(char *path) | |||
328 | } | 329 | } |
329 | 330 | ||
330 | if (pf->num_clipped > 0) { | 331 | if (pf->num_clipped > 0) { |
331 | fprintf(stderr, "Warning: %d characters were clipped " | 332 | fprintf(stderr, "Warning: %d characters out of %u were clipped " |
332 | "(%d at ascent, %d at descent)\n", | 333 | "(%d at ascent, %d at descent)\n", |
333 | pf->num_clipped, pf->num_clipped_ascent, pf->num_clipped_descent); | 334 | pf->num_clipped, pf->nchars, |
335 | pf->num_clipped_ascent, pf->num_clipped_descent); | ||
334 | fprintf(stderr, " max overflows: ascent: %d, descent: %d\n", | 336 | fprintf(stderr, " max overflows: ascent: %d, descent: %d\n", |
335 | pf->max_over_ascent, pf->max_over_descent); | 337 | pf->max_over_ascent, pf->max_over_descent); |
336 | } | 338 | } |
@@ -348,7 +350,7 @@ struct font* bdf_read_font(char *path) | |||
348 | int bdf_read_header(FILE *fp, struct font* pf) | 350 | int bdf_read_header(FILE *fp, struct font* pf) |
349 | { | 351 | { |
350 | int encoding; | 352 | int encoding; |
351 | int nchars, maxwidth; | 353 | int maxwidth; |
352 | int firstchar = 65535; | 354 | int firstchar = 65535; |
353 | int lastchar = -1; | 355 | int lastchar = -1; |
354 | char buf[256]; | 356 | char buf[256]; |
@@ -410,7 +412,7 @@ int bdf_read_header(FILE *fp, struct font* pf) | |||
410 | continue; | 412 | continue; |
411 | } | 413 | } |
412 | if (isprefix(buf, "CHARS ")) { | 414 | if (isprefix(buf, "CHARS ")) { |
413 | if (sscanf(buf, "CHARS %d", &nchars) != 1) { | 415 | if (sscanf(buf, "CHARS %u", &pf->nchars) != 1) { |
414 | fprintf(stderr, "Error: bad 'CHARS'\n"); | 416 | fprintf(stderr, "Error: bad 'CHARS'\n"); |
415 | return 0; | 417 | return 0; |
416 | } | 418 | } |
@@ -465,7 +467,7 @@ int bdf_read_header(FILE *fp, struct font* pf) | |||
465 | maxwidth = pf->fbbw; | 467 | maxwidth = pf->fbbw; |
466 | 468 | ||
467 | /* initially use font maxwidth * height for bits allocation*/ | 469 | /* initially use font maxwidth * height for bits allocation*/ |
468 | pf->bits_size = nchars * BITMAP_WORDS(maxwidth) * pf->height; | 470 | pf->bits_size = pf->nchars * BITMAP_WORDS(maxwidth) * pf->height; |
469 | 471 | ||
470 | /* allocate bits, offset, and width arrays*/ | 472 | /* allocate bits, offset, and width arrays*/ |
471 | pf->bits = (bitmap_t *)malloc(pf->bits_size * sizeof(bitmap_t) + EXTRA); | 473 | pf->bits = (bitmap_t *)malloc(pf->bits_size * sizeof(bitmap_t) + EXTRA); |