Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mcsun!hp4nl!nlbull!jos From: jos@bull.nl (Jos Vos) Newsgroups: comp.lang.postscript Subject: Re: Unix Fonts Message-ID: <1012@nlbull.bull.nl> Date: 28 Mar 91 09:43:23 GMT References: <91080.111931SMITHM@QUCDN.QueensU.CA> Organization: Bull, P.O. Box 22859, NL-1100 DJ Amsterdam, The Netherlands Lines: 366 In article <91080.111931SMITHM@QUCDN.QueensU.CA> SMITHM@QUCDN.QueensU.CA writes: >This is probably not your responsibility, but a number of people told >me that the following strategy works just dandy: > 1. Order the Dos format of the fonts. > 2. Run a "simple" program to convert the pfb files for Unix. Here's the unfont.c program for converting .pfb files to PostScript. It was posted a long time ago on Usenet (not by myself). The patch (unfont.patch) I made myself, and is necessary to generate a PostScript file with a lines of a reasonable length. The file preload.ps should be sent to the printer in the same job as the PostScript font in order to load the font permanently. #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create: # unfont.c # unfont.patch # proload.ps # This archive created: Thu Mar 28 10:42:30 1991 # By: Jos Vos () export PATH; PATH=/bin:/usr/bin:$PATH if test -f 'unfont.c' then echo shar: "will not over-write existing file 'unfont.c'" else cat << \SHAR_EOF > 'unfont.c' /* * NOTICE * * Copyright 1988, 1989 by h-three Systems Corporation. * * Permission is hereby granted for this software's free reproduction * and modification for non-commercial purposes, provided that this * notice is retained. Commercial enterprises may give away copies * as part of their products provided that they do so without charge, * that they retain this notice, and that they acknowledge the source * of the software. * * PostScript is a registered trademark of Adobe Systems Incorporated. * IBM is a registered trademark of International Business Machines * Corporation. * * h-three Systems Corporation * 100 Park Drive Suite 204/ P.O. Box 12557 * Research Triangle Park, NC 27709 */ #ifdef NOWHAT static char *sccsid = "%W% - %E%"; #endif /* * unfont.c * * usage: unfont [ -v ] [ files ] * -v Prints execution information on the standard error. * * Unpacks IBM PC-format PostScript fonts into a downloadable form. * */ char *USAGE = "\ usage: unfont [ -? ] [ -v ] [files ]\n\ -? Prints this message.\n\ -v Prints execution information on the standard error.\n\ "; #include #include #include #include #define OK 0 #define FAILURE (-1) #define Failed(x) ((x) == FAILURE) #define TRUE 1 #define FALSE 0 typedef char bool; #define STREQ(a,b) (strcmp(a,b) == 0) FILE *fp; /* * used to convert nibbles (n0 is least sig) to ascii-hex */ #define N0(c) hexbyt[((c) & 0x000f)] #define N1(c) N0((c) >> 4) char hexbyt[] = "0123456789ABCDEF"; /* * vars controlled by command line options */ bool verbose = FALSE; /* be verbose */ extern char *optarg; /* getopt(3) control vars */ extern int optind; extern int errno; char *infile; char *progname; /* for error() */ char *strchr(), *strrchr(); long stol(), getparm(); int mygetc(); void dounfont(); long getcount(); void bintohex(); main(argc, argv) int argc; char **argv; { register int c; bool showusage = FALSE; /* usage error? */ /* * figure out invocation leaf-name */ if ((progname = strrchr(argv[0], '/')) == (char *) NULL) progname = argv[0]; else progname++; argv[0] = progname; /* for getopt err reporting */ /* * Check options and arguments. */ progname = argv[0]; while ((c = getopt(argc, argv, "v")) != EOF) switch (c) { case 'v': /* toggle verbose */ verbose = ! verbose; break; case '?': showusage = TRUE; } if (showusage) { (void) fprintf(stderr, "%s", USAGE); exit(1); } /* unfont stuff */ if (argv[optind]) { for ( ; argv[optind]; optind++) { if (!(fp = fopen(argv[optind], "r"))) { error(0, "can't open input file '%s'", argv[optind]); continue; } infile = argv[optind]; dounfont(); close(fp); } } else { infile = ""; fp = stdin; dounfont(); } exit(0); } long getcount(); void dounfont() { register int c; register int ch; long count; register int i; for (;;) { if ((c = mygetc()) != 0x80) { error(0, "not a proper font data segment '%s'", infile); error(0, "foobar char is 0x%x", c); exit(1); } c = mygetc(); switch (c) { case 1: /* get count, output count bytes to stdout */ count = getcount(); if (verbose) fprintf(stderr, "case1 count is %ld\n", count); for (i=0; i: ' * If 'errn' is non-zero, it is assumed to be an 'errno' and its * associated error message is appended to the output. */ /*VARARGS*/ error(errn, va_alist) int errn; va_dcl { va_list arglist; register char *format; extern char *sys_errlist[]; extern int sys_nerr; extern int errno; if (errn == -1) /* use errno if -1 */ errn = errno; va_start(arglist); format = va_arg(arglist, char *); (void) fprintf(stderr, "%s: ", progname); (void) vfprintf(stderr, format, arglist); va_end(arglist); if (errn) if ((errn > 0) && (errn <= sys_nerr)) (void) fprintf(stderr, " (%s)\n", sys_errlist[errn]); else (void) fprintf(stderr, " (unknown errno=%d)\n", errn); else (void) fprintf(stderr, "\n"); } SHAR_EOF fi if test -f 'unfont.patch' then echo shar: "will not over-write existing file 'unfont.patch'" else cat << \SHAR_EOF > 'unfont.patch' *** unfont.c- Thu Jan 12 11:34:25 1989 --- unfont.c Fri Apr 27 06:55:48 1990 *************** *** 174,181 **** count = getcount(); if (verbose) fprintf(stderr, "case1 count is %ld\n", count); ! for (i=0; i 'proload.ps' %! 0 serverdict begin exitserver % (%stdin) (r) file cvx exec SHAR_EOF fi exit 0 # End of shell archive -- -- Jos Vos (UUCP: ...!{uunet,mcsun,hp4nl}!nlbull!jos) -- Bull Nederland NV, Product Support Unix, Amsterdam, The Netherlands