[comp.lang.postscript] how to download an Adobe font with UNIX

dberry@ (Daniel M. Berry) (06/12/91)

We licensed a copy of an Adobe font... sonata specifically
We were given a choice of PC or Mac format, and chose PC format
because we have PC's here but no Mac's. However the PC's are NOT
connected to any of the printers.. They're all connected to Unix machines,
so that we use lpr to send PostScript files to the printers.
lpr refused to send the so______.pfb file because it began with something
binary and not ascii.. 
So I stripped that header off and got down to something beginning
with %!.. I sent this and this time the printer complained that a
command looking like swearing (ie characters not in the standard
7bit ascii range) was not defined... The file contains binary and
the printer cannot accept.. 

Has anyone surmounted the problem? Is there a magiv incantation that
one must mutter to lpr or the printer to get the printer to accept
the font definition..

There's gotta be.. because I cannot believe that you cannot use these
fonts through UNIX.

Thanks
DAn

steves@mcrware.UUCP (Steve Simpson) (06/13/91)

In article <9990@discus.technion.ac.il> you write:
>We licensed a copy of an Adobe font... sonata specifically
>We were given a choice of PC or Mac format, and chose PC format
>because we have PC's here but no Mac's. However the PC's are NOT
>
>There's gotta be.. because I cannot believe that you cannot use these
>fonts through UNIX.
>
>Thanks
>DAn


Dan,

What desktop publishing package are you using?  If you are using FrameMaker,
I can help.  Otherwise, there are a few things I CAN tell you.  The files you have
from Adobe will probably need to be convert and/or renamed. I have only worked
in the FrameMaker realm, so I can't begin to tell you what needs to be done outside
that realm.


Let me know if you are using FrameMaker on you UNIX system.

==============================================
"Homer" Simpson
"Remember...As far as anyone knows,
we're a nice, normal family."
Disclaimer: My words, not theirs.
==============================================

selig@udcps3.cps.udayton.edu (Paul D. Selig) (06/14/91)

In article <9990@discus.technion.ac.il> dberry@ (Daniel M. Berry) writes:
>We licensed a copy of an Adobe font... sonata specifically
>We were given a choice of PC or Mac format, and chose PC format
>because we have PC's here but no Mac's. However the PC's are NOT
>connected to any of the printers.. They're all connected to Unix machines,
>so that we use lpr to send PostScript files to the printers.
>lpr refused to send the so______.pfb file because it began with something
>binary and not ascii.. 

Dan,

	The postscript fonts you received are in a binary format which, as
you found out, cannot be transferred directly to the postscript printer.  
You are in luck, though, since you ordered the IBM version of the font.  On
the other disks that came with the font, you will find a utility called
"sendps", which will translate the font into a usable ASCII format that
lpr will accept.  You will need to run sendps on each font you want to
convert, redirect the output to a file, and transfer that file to the
unix host.

Hope this helps.....

Paul

-- 
Paul Selig, Jr.			Unix Systems Administrator
The University of Dayton, Computer Science Department, Anderson Center 133
INTERNET: selig@udcps3.cps.udayton.edu	BITNET: selig@dayton.bitnet
    UUCP: ...!uunet!dayvb!udcps3!selig

jos@bull.nl (Jos Vos) (06/14/91)

In article <9990@discus.technion.ac.il> dberry@ (Daniel M. Berry) writes:

>We licensed a copy of an Adobe font... sonata specifically
>lpr refused to send the so______.pfb file because it began with something
>binary and not ascii.. 

Here we go again: it's becoming a VFAQ :-)

[ B.t.w., Daniel, your article's From: header didn't contain
  anything after the @..., so a reply wasn't possible... ]

This program converts .pfb files to PostScript code that can be
sent to a PostScript printer (the main thing it does is converting
the binary code to hex code, as is done by the fontloader that is
normally be included with a font delivered on MS-DOS format).

----------CUT-HERE----------
/*
 * 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
 *
 * CHANGE HISTORY
 *
 * -  A small change was made by Jos Vos <jos@bull.nl> to generate
 *    a PostScript program with a '\n' ('\012') as line separator
 *    i.s.o. a '\r' ('\015').
 */

#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 <stdio.h>
#include <fcntl.h>
#include <ctype.h>
#include <varargs.h>

#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 = "<stdin>";
	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<count; i++) {
			c = mygetc();
    			putchar(c == '\r' ? '\n' : c);
		}
		break;
	case 2:		
		/* get count, convert count bytes to hex, output	*/
		/* to stdout						*/
		count = getcount();
		if (verbose)
		    fprintf(stderr, "case2 count is %ld\n", count);
		bintohex(count);
		break;
	case 3:		
		/* reached EOF; next file, please 			*/
		if (verbose)
		    fprintf(stderr, "logical eof encountered\n");
		return;

	default:
		error(0, "not a valid segment type '%s'", infile);	
		return;
	}
    }
}

/* 
 * getc for error-checking	
 */

int
mygetc()
{
	int ch;
    	if ((ch = getc(fp)) == -1) {
	    error(-1, "unexpected eof on input in '%s'", infile);
	    exit(1);
	}
    	return(ch);
}

/*
 * get count of bytes from segment header
 */

long
getcount()
{
	int i;
	long count = 0;

    	for (i=0; i<4; i++)
       		count += ((long) mygetc()) << (i * 8);
	return(count);
}

/* 
 * convert binary to ASCII hex and write it to stdout
 */

void
bintohex(count)
long count;
{
	int ch;
	long i;

	for (i=0; i<count; i++) {
	        if ((i % 30) == 0)
		    putchar('\n');
   		ch = mygetc();
    		putchar(N1(ch));
    		putchar(N0(ch));
	}
}

/* end of unfont stuff

/*
 * error(errn, arglist)
 *	report an error to stderr using printf(3) conventions.
 *	Any output is preceded by '<progname>: '
 *	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");
}
----------CUT-HERE----------

-- 
--    Jos Vos <jos@bull.nl>    (UUCP: ...!{uunet,mcsun,hp4nl}!nlbull!jos)
--    Bull Nederland NV, Product Support Unix, Amsterdam, The Netherlands

rchui@neptune.nswc.navy.mil (Chui) (06/16/91)

We licensed a copy of an Adobe font... sonata specifically
We were given a choice of PC or Mac format, and chose PC format
because we have PC's here but no Mac's. However the PC's are NOT
connected to any of the printers.. They're all connected to Unix machines,
so that we use lpr to send PostScript files to the printers.
lpr refused to send the so______.pfb file because it began with something
binary and not ascii.. 
So I stripped that header off and got down to something beginning
with %!.. I sent this and this time the printer complained that a
command looking like swearing (ie characters not in the standard
7bit ascii range) was not defined... The file contains binary and
the printer cannot accept.. 

Has anyone surmounted the problem? Is there a magiv incantation that
one must mutter to lpr or the printer to get the printer to accept
the font definition..

There's gotta be.. because I cannot believe that you cannot use these
fonts through UNIX.


-----------------------------------------------------------------------------

1st what printer you connected to Unix machine?
2nd You must buy a Postscript cartridge and install to the printer.
3rd You need to write a output filter file for Postscript file, install this
    outout filter file in /etc/printcap file of=/usr/local/lib/offil.

	I am working on that output filter file right now. This output filter
file must perform three functions.

	1) Check is it a Postcript file?
	2) Check is(are) there other print job(s) on the printer?
	If 1) is True and 2) is False, then sent a toggle signal to printer, 
	switch to Postscript mode. 
	3) Sent print job.

	I will post the source code of the output filter file. Or if anyone
know there is other way to print the Postscript file in Unix machine. Please
post in this newsgroup or email to me.

email address: rchui@neptune.nswc.navy.mil

	-Raymond

duc@mport.COM (Richard Ducoty) (06/19/91)

rchui@neptune.nswc.navy.mil (Chui) writes:

>We licensed a copy of an Adobe font... sonata specifically
>We were given a choice of PC or Mac format, and chose PC format
>because we have PC's here but no Mac's. However the PC's are NOT
>connected to any of the printers.. They're all connected to Unix machines,
>so that we use lpr to send PostScript files to the printers.
>lpr refused to send the so______.pfb file because it began with something
>binary and not ascii.. 
...
>There's gotta be.. because I cannot believe that you cannot use these
>fonts through UNIX.
>-----------------------------------------------------------------------------

>1st what printer you connected to Unix machine?
>2nd You must buy a Postscript cartridge and install to the printer.

================
We use an Apple Laser printer directly on a serial line - works great
I also have a LaserJet II with a postscript cartridge, also works

===============

>3rd You need to write a output filter file for Postscript file, install this
>    outout filter file in /etc/printcap file of=/usr/local/lib/offil.

====================
Or you can get SVR4 - it has quite a bit of Postscript support, lots of
filters (troff, text, plot, tektronix, etc) - troff is especially easy to use



Richard Ducoty		        \\\\\\\				
Microport Inc.		          (.)(.) 			root@mport.com
voice=> (408) 438-8649	             >	 		  	duc@mport.com
fax=>   (408) 438-7560		    -				uunet!mport!duc
                          " militiae species amor est "