summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlexander Levin <al.le@rockbox.org>2009-03-06 23:32:08 +0000
committerAlexander Levin <al.le@rockbox.org>2009-03-06 23:32:08 +0000
commit031ac442c542b3c712c194636a812ee987c4a455 (patch)
tree7cf3b3d71dc8ab5aacaccfb9f4c1427d7920666a /tools
parent2af0b60aaa2f540a14d54ae4f697cf75dcfc08e5 (diff)
downloadrockbox-031ac442c542b3c712c194636a812ee987c4a455.tar.gz
rockbox-031ac442c542b3c712c194636a812ee987c4a455.tar.bz2
rockbox-031ac442c542b3c712c194636a812ee987c4a455.zip
Only print clip warnings in verbose mode
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20222 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rw-r--r--tools/convbdf.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/tools/convbdf.c b/tools/convbdf.c
index b7790416a7..9e684512a7 100644
--- a/tools/convbdf.c
+++ b/tools/convbdf.c
@@ -75,6 +75,10 @@ struct font {
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
+/* Depending on the verbosity level some warnings are printed or not */
+int verbose = 0;
+#define VERBOSE_CLIP 1 /* Only print clip related warnings if verb >= this */
+
int gen_c = 0;
int gen_h = 0;
int gen_fnt = 0;
@@ -113,6 +117,7 @@ usage(void)
" -s N Start output at character encodings >= N\n"
" -l N Limit output to character encodings <= N\n"
" -n Don't generate bitmaps as comments in .c file\n"
+ " -v N Verbosity level: 0=quite quiet, 1=more verbose\n"
};
fprintf(stderr, "%s", help);
@@ -186,6 +191,18 @@ void getopts(int *pac, char ***pav)
start_char = atoi(av[0]);
}
break;
+ case 'v': /* verbosity */
+ if (*p) {
+ verbose = atoi(p);
+ while (*p && *p != ' ')
+ p++;
+ }
+ else {
+ av++; ac--;
+ if (ac > 0)
+ verbose = atoi(av[0]);
+ }
+ break;
default:
fprintf(stderr, "Unknown option ignored: %c\r\n", *(p-1));
}
@@ -332,13 +349,15 @@ struct font* bdf_read_font(char *path)
goto errout;
}
- if (pf->num_clipped > 0) {
- fprintf(stderr, "Warning: %d characters out of %d were clipped "
- "(%d at ascent, %d at descent)\n",
- 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);
+ if (verbose >= VERBOSE_CLIP) {
+ if (pf->num_clipped > 0) {
+ fprintf(stderr, "Warning: %d characters out of %d were clipped "
+ "(%d at ascent, %d at descent)\n",
+ 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);
+ }
}
fclose(fp);
@@ -587,9 +606,11 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
pf->max_over_ascent = overflow_asc;
}
bbh = MAX(bbh - overflow_asc, 0); /* Clipped -> decrease the height */
- fprintf(stderr, "Warning: character %d goes %d pixel(s)"
- " beyond the font's ascent, it will be clipped\n",
- encoding, overflow_asc);
+ if (verbose >= VERBOSE_CLIP) {
+ fprintf(stderr, "Warning: character %d goes %d pixel(s)"
+ " beyond the font's ascent, it will be clipped\n",
+ encoding, overflow_asc);
+ }
}
overflow_desc = -bby - pf->descent;
if (overflow_desc > 0) {
@@ -599,9 +620,11 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf)
}
bby += overflow_desc;
bbh = MAX(bbh - overflow_desc, 0); /* Clipped -> decrease the height */
- fprintf(stderr, "Warning: character %d goes %d pixel(s)"
- " beyond the font's descent, it will be clipped\n",
- encoding, overflow_desc);
+ if (verbose >= VERBOSE_CLIP) {
+ fprintf(stderr, "Warning: character %d goes %d pixel(s)"
+ " beyond the font's descent, it will be clipped\n",
+ encoding, overflow_desc);
+ }
}
if (overflow_asc > 0 || overflow_desc > 0) {
pf->num_clipped++;