summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2018-04-08 20:30:52 +0000
committeremaste <emaste@FreeBSD.org>2018-04-08 20:30:52 +0000
commit065993ebacbad379f81d9a6ae8dce3c566ca5523 (patch)
tree7ca68236e9ab941aba283516ca2c51d0391e549f /usr.bin
parent7dbd5eee062b4d1f1ace1162c866c8c65b390760 (diff)
downloadFreeBSD-src-065993ebacbad379f81d9a6ae8dce3c566ca5523.zip
FreeBSD-src-065993ebacbad379f81d9a6ae8dce3c566ca5523.tar.gz
MFC r331935: vtfontcvt: allow .bdf characters less than full height
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/vtfontcvt/vtfontcvt.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c
index ffe43b5..f1d2eaa 100644
--- a/usr.bin/vtfontcvt/vtfontcvt.c
+++ b/usr.bin/vtfontcvt/vtfontcvt.c
@@ -265,10 +265,23 @@ parse_bdf(FILE *fp, unsigned int map_idx)
if (strncmp(ln, "BITMAP", 6) == 0 &&
(ln[6] == ' ' || ln[6] == '\0')) {
+ /*
+ * Assume that the next _height_ lines are bitmap
+ * data. ENDCHAR is allowed to terminate the bitmap
+ * early but is not otherwise checked; any extra data
+ * is ignored.
+ */
for (i = 0; i < height; i++) {
if ((ln = fgetln(fp, &length)) == NULL)
errx(1, "Unexpected EOF!\n");
ln[length - 1] = '\0';
+ if (strcmp(ln, "ENDCHAR") == 0) {
+ memset(bytes + i * wbytes, 0,
+ (height - i) * wbytes);
+ memset(bytes_r + i * wbytes, 0,
+ (height - i) * wbytes);
+ break;
+ }
sscanf(ln, "%x", &line);
if (parse_bitmap_line(bytes + i * wbytes,
bytes_r + i * wbytes, line, dwidth) != 0)
OpenPOWER on IntegriCloud