Author: emaste
Date: Mon Apr  9 12:57:08 2018
New Revision: 332322
URL: https://svnweb.freebsd.org/changeset/base/332322

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

Modified:
  stable/10/usr.bin/vtfontcvt/vtfontcvt.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/vtfontcvt/vtfontcvt.c
==============================================================================
--- stable/10/usr.bin/vtfontcvt/vtfontcvt.c     Mon Apr  9 12:55:09 2018        
(r332321)
+++ stable/10/usr.bin/vtfontcvt/vtfontcvt.c     Mon Apr  9 12:57:08 2018        
(r332322)
@@ -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)
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to