diff --git a/tools/convbdf.c b/tools/convbdf.c old mode 100644 new mode 100755 index aae5b43..44a8aa9 --- a/tools/convbdf.c +++ b/tools/convbdf.c @@ -443,6 +443,7 @@ int bdf_read_header(FILE *fp, struct font* pf) /* use the font boundingbox to get initial maxwidth*/ /*maxwidth = pf->fbbw - pf->fbbx;*/ maxwidth = pf->fbbw; + pf->maxwidth = maxwidth; /* initially use font maxwidth * height for bits allocation*/ pf->bits_size = nchars * BITMAP_WORDS(maxwidth) * pf->height; @@ -506,7 +507,8 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf) } /* use font boundingbox width if DWIDTH <= 0*/ if (width <= 0) - width = pf->fbbw - pf->fbbx; + width = pf->fbbw; + /* width = pf->fbbw - pf->fbbx; */ continue; } if (isprefix(buf, "BBX ")) { @@ -535,12 +537,19 @@ int bdf_read_bitmaps(FILE *fp, struct font* pf) /* calc char width*/ if (bbx < 0) { width -= bbx; - /*if (width > maxwidth) - width = maxwidth;*/ + if (width > maxwidth) + width = maxwidth; bbx = 0; } if (width > maxwidth) maxwidth = width; + if (maxwidth > pf->maxwidth) + { + fprintf(stderr, + "Error: %s char[%d] maxwidth(%d)>pf->maxwidth(%d)\n", + pf->facename, encoding, maxwidth, pf->maxwidth); + return 0; + } pf->width[encoding-pf->firstchar] = width; /* clear bitmap*/