From owner-freebsd-questions Thu Jul 8 19:43:50 1999 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 62DF014D0C for ; Thu, 8 Jul 1999 19:43:39 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from rainbow5.scientia.demon.co.uk ([192.168.1.2] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.02 #1) id 112Ojj-0001Rp-00; Fri, 09 Jul 1999 01:41:56 +0100 (envelope-from ben@rainbow5.scientia.demon.co.uk) Received: from rainbow5.scientia.demon.co.uk (ident=ben) by rainbow5.scientia.demon.co.uk with local (Exim 3.02 #1) id 112Ojk-000Clv-00; Fri, 09 Jul 1999 01:41:56 +0100 (envelope-from ben@rainbow5.scientia.demon.co.uk) Date: Fri, 9 Jul 1999 01:41:56 +0100 From: Ben Smithurst To: Mark Ovens Cc: Evren Yurtesen , freebsd-questions@freebsd.org Subject: Re: how to create a font ? Message-ID: <19990709014156.A49065@rainbow5.scientia.demon.co.uk> References: <3783A62B.6976A379@ispro.net.tr> <19990707233530.A42991@rainbow5.scientia.demon.co.uk> <19990709013048.B254@marder-1> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=jRHKVT23PllUwdXP X-Mailer: Mutt 0.95.4i In-Reply-To: <19990709013048.B254@marder-1> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Mark Ovens wrote: > Are fontdump & fontmake the "*very* rough programs" that you're > talking about? If so, where are they available from? Self-LART for me there, I meant to attach them. They're here this time, honest. -- Ben Smithurst | PGP: 0x99392F7D ben@scientia.demon.co.uk | key available from keyservers and | ben+pgp@scientia.demon.co.uk --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fontdump.c" #include #include #include #include #include #include #include void usage(); void font_dump(FILE *, int); int main(int argc, char **argv) { FILE *fp; struct stat sb; int size; if (getopt(argc, argv, "") != -1) usage(); argc -= optind; argv += optind; if (argc != 1) usage(); if ((fp = fopen(*argv, "r")) == NULL) err(1, "%s", *argv); if (fstat(fileno(fp), &sb) < 0) err(1, "fstat"); if (sb.st_size == 16 * 256) size = 16; else if (sb.st_size == 14 * 256) size = 14; else if (sb.st_size == 8 * 256) size = 8; else errx(1, "unknown font size"); font_dump(fp, size); return (0); } void font_dump(FILE *fp, int size) { int ch, li, d, bit; for (ch = 0; ch < 256; ch++) { printf("- %c ----\n", isprint(ch) ? ch : ' '); for (li = 0; li < size; li++) { d = getc(fp); if (d == EOF) errx(1, "unexpected EOF"); for (bit = 7; bit >= 0; bit--) if (d & (1 << bit)) printf("#"); else printf(" "); printf("\n"); } printf("--------\n"); } } void usage() { fprintf(stderr, "usage: fontedit font\n"); exit(1); } --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="fontmake.c" #include #include #include #include #include #include #include void usage(); void font_make(FILE *); int main(int argc, char **argv) { FILE *fp; if (getopt(argc, argv, "") != -1) usage(); argc -= optind; argv += optind; if (argc != 1) usage(); if ((fp = fopen(*argv, "r")) == NULL) err(1, "%s", *argv); font_make(fp); return (0); } void font_make(FILE *fp) { char line[20]; int byte, bit, size; size = 0; while (fgets(line, sizeof line, fp) != NULL) { if (strlen(line) > 4 && strcmp(line + 4, "----\n") == 0) { if (size != 0 && size != 8 && size != 14 && size != 16) errx(1, "bad file format, wrong size"); else { size = 0; continue; } } size++; byte = 0; for (bit = 0; bit < 8; bit++) if (line[bit] == '\n') /* end of line, assume all spaces */ break; else if (line[bit] == '#') byte |= 1 << (7 - bit); else if (line[bit] != ' ') errx(1, "bad file format, " "bad character %c (%x)", line[bit], line[bit]); putc(byte, stdout); } if (size != 0 && size != 8 && size != 14 && size != 16) errx(1, "bad file format, wrong size %d (at end)", size); } void usage() { fprintf(stderr, "usage: fontedit font\n"); exit(1); } --jRHKVT23PllUwdXP-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message