From owner-svn-src-all@FreeBSD.ORG Tue Jun 3 17:53:12 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 19EA04BD; Tue, 3 Jun 2014 17:53:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E01C72511; Tue, 3 Jun 2014 17:53:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s53HrBEl095508; Tue, 3 Jun 2014 17:53:11 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s53HrB6X095507; Tue, 3 Jun 2014 17:53:11 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201406031753.s53HrB6X095507@svn.freebsd.org> From: Ed Maste Date: Tue, 3 Jun 2014 17:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267011 - head/tools/tools/vt/fontcvt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jun 2014 17:53:12 -0000 Author: emaste Date: Tue Jun 3 17:53:11 2014 New Revision: 267011 URL: http://svnweb.freebsd.org/changeset/base/267011 Log: vt fontcvt: Make height and width optional arguments Now defaults to a 16x8 font size. The height and width can be specified using -h and -w respectively. Sponsored by: The FreeBSD Foundation Modified: head/tools/tools/vt/fontcvt/fontcvt.c Modified: head/tools/tools/vt/fontcvt/fontcvt.c ============================================================================== --- head/tools/tools/vt/fontcvt/fontcvt.c Tue Jun 3 14:50:51 2014 (r267010) +++ head/tools/tools/vt/fontcvt/fontcvt.c Tue Jun 3 17:53:11 2014 (r267011) @@ -39,12 +39,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #define VFNT_MAPS 4 #define VFNT_MAP_NORMAL 0 #define VFNT_MAP_BOLD 2 -static unsigned int width, wbytes, height; +static unsigned int width = 8, wbytes, height = 16; struct glyph { TAILQ_ENTRY(glyph) g_list; @@ -83,7 +84,7 @@ usage(void) { fprintf(stderr, -"usage: fontcvt width height normal.bdf bold.bdf out.fnt\n"); +"usage: fontcvt [-w width] [-h height] normal.bdf bold.bdf out.fnt\n"); exit(1); } @@ -384,27 +385,42 @@ write_fnt(const char *filename) int main(int argc, char *argv[]) { + int ch; assert(sizeof(struct file_header) == 32); assert(sizeof(struct file_mapping) == 8); - if (argc != 6) + while ((ch = getopt(argc, argv, "h:w:")) != -1) { + switch (ch) { + case 'h': + height = atoi(optarg); + break; + case 'w': + height = atoi(optarg); + break; + case '?': + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc != 3) usage(); - - width = atoi(argv[1]); + wbytes = howmany(width, 8); - height = atoi(argv[2]); - if (parse_bdf(argv[3], VFNT_MAP_NORMAL) != 0) + if (parse_bdf(argv[0], VFNT_MAP_NORMAL) != 0) return (1); - if (parse_bdf(argv[4], VFNT_MAP_BOLD) != 0) + if (parse_bdf(argv[1], VFNT_MAP_BOLD) != 0) return (1); number_glyphs(); fold_mappings(0); fold_mappings(1); fold_mappings(2); fold_mappings(3); - if (write_fnt(argv[5]) != 0) + if (write_fnt(argv[2]) != 0) return (1); printf(