svn commit: r331935 - head/usr.bin/vtfontcvt

Ed Maste emaste at FreeBSD.org
Tue Apr 3 18:43:01 UTC 2018


Author: emaste
Date: Tue Apr  3 18:43:00 2018
New Revision: 331935
URL: https://svnweb.freebsd.org/changeset/base/331935

Log:
  vtfontcvt: allow .bdf characters less than full height
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/vtfontcvt/vtfontcvt.c

Modified: head/usr.bin/vtfontcvt/vtfontcvt.c
==============================================================================
--- head/usr.bin/vtfontcvt/vtfontcvt.c	Tue Apr  3 18:41:27 2018	(r331934)
+++ head/usr.bin/vtfontcvt/vtfontcvt.c	Tue Apr  3 18:43:00 2018	(r331935)
@@ -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!");
 				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)


More information about the svn-src-head mailing list