[mod.computers.laser-printers] Info-Postscript for Laser Lovers Digest V1 #12

Laser-Lovers-Request@WASHINGTON.ARPA.UUCP (07/12/86)

Info-Postscript for Laser Lovers Digest Saturday, July 12, 1986 1:13PM
Volume 1, Issue 12

Today's Topics:

                improved LaserWriter serial I/O patch
                 Bit Smoothing on Apple Laserwriter?
                    Epson Printer Emulator Wanted
            C program to convert text files to PostScript
                 Bit Smoothing on Apple Laserwriter?
               Re:  Bit Smoothing on Apple Laserwriter?

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

From: adobe!taft@decwrl.DEC.COM (Ed Taft)
Date:  4 Apr 1986 1442-PST (Friday)
Subject: improved LaserWriter serial I/O patch

Several months ago, I circulated a downloadable program that corrects
several known problems in the LaserWriter's serial I/O handler.
Unfortunately, the patch did not completely fix one of the problems.
This message contains a revised patch that works better.

The problems corrected by the patch are:

  - occasional failure to send a needed XON after XOFF;
  - erroneously reading past end-of-file under some circumstances;
  - lost or garbled characters in serial output to the host.

The patch applies only to the original LaserWriter (PostScript version
23.0) and not to any other PostScript printer; it affects serial
communication only (not AppleTalk). To install the patch, first edit
the program if necessary to change the system administrator password;
then send it as a separate job to the printer. Once installed, the
patch persists until the printer is next turned off.

	Ed Taft
	Adobe Systems, Inc.

---------- cut here ----------
%! 
0000000000			% the exitserver password

version (23.0) ne
   {(Patch not installed -- wrong printer type or version) = stop} if
statusdict /Patch1Installed known
   {(Patch already installed -- not installed again) = stop} if
serverdict begin exitserver
statusdict /Patch1Installed true put
currentfile eexec
c3c703843e75cc772962e3a7fadee742bb1258167ac7020cbc1cdfd379c35f53
da38afaed75c86541fde979ff594180fe542991f2199c8614247e4a1e3e5ecff
8bc3844d36e2d091e9f649518473592b44be262c7a2929ac4a9acd626bd3c441
e2aae320e60b2c21e02bc9c4f3cde0d5eca674f5b0bbff3ee860a7cd2e4e9f7b
9eed9b1286e5a9b9b0fdf8e73951152837a16a6913e477cc8a4f3cebbf2e78e8
fe5b0f92d45a274e75df31e5182cd81dce61bc53bdb8685f0a7ce24c0b8440f7
67b7fd750bb998fc775415b1c7b8502ea7c744ccb807635f7244d3fdd6ebd01f
634c9f3241fddc1a95d62bfb710a9ea6831ec6e1792f60503f077868e860dc3a
518d8ac29dc625ec65157889cd1f943a37eb55ef0e44c3a4776a481f1dd10cda
79b3db9907295c0ab9e3142df3ef0840b07f29d67c4f8aba333c9cc6e9f57d3f
47083e0bd9e85151ef158308a7d991b02ddcf47bffe6fed2f8e342dd7d2f81ca
80bb689bd0cb5af2a471b5577a4f8dbdfd2b0fcd0267bfa4dc6038bc235d3d8b
35469a680b41dc95e6a1d48ba543d291575d72475ef512492547629c4db741b8
68705f01282c230e1570cea8daea989707e99dce1d11d561256bd24608a66945
2042384aadfcc25cb0167b5896b1a13092d0a7c4ce1343e30834de5d5df345b9
ccb742acf36f7d3a9b43361cf5a9e0121fec84ba8b6c06312a71600ab9783ddc
59b8cb4da03019e82690df5cb2aefd9026aed30efb24b19e5405410685eb35b3
b25cf8ba535156ee600749abf2e3c572313c62dcd9492ca3abcfe7ee8fd40410
902f417c82908b412c9a826206f4292ab5196013a5f3615661cf81fc60b36a84
f457c2adb1a0c1c19f089d170de47d6933ce247d44865035caa1a6d4a2f6986f
9856de5f3d05a5a1020bce9768df8e8aab928b90029dfc2bbb715e19b5e7bc3e
11f05c1dad24849f8aadb7867f9d92f4400a432cdd6587057c582dc25fbeadde
f75121202e2a90dc6a4491ae9ee2b39c5fab5071a2f415d4a3cf8357fff771d8
790cc5788d506086c5a07ddbc2997f3abe28972cd40275c0117c77f479fd0b74
53a0bfcd82f30d1eb3c35fc914657d6f484bf3be81c54238267ccc2a19ec42a3
1336014c6446b12e3fe7746b658f829c52173a78e456ad78c2d65a3209949a5a
735d3795579151ee0102773c204134e8563b011a90c7cf0622058081c60b4d5d
6a146eb610c92e2e9c05f7ca40a1375e7c397def7f0d6a4c65e22728ae30adc2
b1b088339a7e7ab8f2dc6a3b5abd1318663cc5d3c37edd57f8ace64a565d1775
6e5a1268986105c918547306e0bf12d128220771e074323746ac15c52ef16e95
c0e62a0746b7c202a2e2aba2060cd64d5f656dbeb1fa837734d4a23093ddb312
537c0a6f8e224e5aa6cd22f1740e3611550b85d1a447c58ca8
---------- cut here ----------

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

Date: Mon, 7 Apr 86 01:33:13 est
From: Ken Mandelberg <km%emory.csnet@CSNET-RELAY.ARPA>
Subject: Bit Smoothing on Apple Laserwriter?

I know this a topic that has been discussed before, but I don't think I
have heard a definitive answer.

I would like to take the postscript output generated by a Mac including
output with bitmaps (say from macpaint) and print them on an Apple
Laserwriter not attached to Appletalk.  I currently have a postscript
header that can be prepended to Mac-generated postscript output, and
provides the necessary quickdraw definitions. It works on everything
except the bitmaps.

Apparently the reason for this is that Apple considers its bit
smoothing algorithm for printing bitmaps on the laserwriter
proprietary, and on Appletalk the Mac actualy downloads some 68000
machine code to do the work.

What seems to be needed is a header with this code that can be
downloaded from the RS-232, with the other quickdraw definitions.
Failing this, I guess a substitute postscript routine to approximate it
would probably do.

Has anyone worked this out?


Ken Mandelberg
Emory University
Dept of Math and CS
Atlanta, Ga 30322

{akgua,sb1,gatech,decvax}!emory!km   USENET
km@emory                      CSNET
km.emory@csnet-relay          ARPANET

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

Date:  Tue, 8 Apr 86 10:45 EST
From:  "Roger C. King" <RCKing@MIT-MULTICS.ARPA>
Subject:  Epson Printer Emulator Wanted

Does anyone have or know of an emulator which can run on either a PC or
the LaserWriter which will emulate the text and graphics capabilities of
an Epson (standard, now out of date, IBM Graphics) printer?  Such a
program would do a lot to ease the interface of the LaserWriter family
into the PC world.  Presumably such a program would support
'shift-PrtSc' for a graphics dump of the screen.

By the way, for people interested in portfolio management, I note that
the latest PC Week review of stock market software picked as a standout
the Isgur Portfolio system from Batteries Included which runs under GEM
and thus supports both the EGA and the LaserWriter.

Also, for users of Xywrite III, XyQuest now has available an updated PRN
file for the LaserWriter which includes the latest patch posted here
from Adobe, and works well for large documents using either XONXOFF.COM
or AST's SuperSpool.  For people interested in a more 'obscure' PRN file
implementation for the LaserWriter (not the LaserWriter Plus) which has
different capabilities than the XyQuest product, I would be happy to
supply my implementation directly.

Roger King
MIT Lincoln Laboratory
Lexington, MA

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

Date: Thu, 10 Apr 86 17:13:25 est
From: Eric Gisin <egisin%waterloo.csnet@CSNET-RELAY.ARPA>
Subject: C program to convert text files to PostScript

This program is short and very useful so I'm mailing it to info-postscript.

: This is a shar archive.	Extract with sh, not csh.
: The rest of this file will extract:
: Read_me text_ps.1 text_ps.c prapple.com
echo Extracting Read_me
sed 's/^X//' > Read_me << 'e-o-f'
Xtext_ps converts text files to PostScript on stdout.
XIt has been tested on Unix 4.2 and VMS V4.
X
Xtext_ps.c: C source
Xtext_ps.1: Unix man page
Xprapple.com: command file for VMS to run text_ps and print the output
X
XOur Unix lpr/lpd is locally modified
Xso I'm not including any printcap stuff or input filters.
X
X	Eric Gisin, egisin@waterloo.csnet, egisin@watarts.bitnet
X
e-o-f
echo Extracting text_ps.1
sed 's/^X//' > text_ps.1 << 'e-o-f'
X.TH TEXT_PS 1
X.SH NAME
Xtext_ps \- convert text to PostScript
X.SH SYNOPSIS
X\fBtext_ps\fP [\fB-w\fP] [file ...]
X.SH DESCRIPTION
X\fIText_ps\fP converts text files to PostScript on the standard output.
XIf no files are given, text_ps reads from the standard input.
XThe \fB-w\fP flag rotates and compresses the page allowing 132 columns.
X.PP
XAt Waterloo, \fItext_ps\fP is called as a prefilter
Xwhen using \fIlpr\fP to a PostScript printer and the default format.
XIf you send \fItext_ps\fP output to \fIlpr\fP, use the \fB-Fl\fP flag.
X.SH BUGS
XOnly the final character is output when several characters are overstuck with backspace.
X.SH SEE ALSO
Xprinters(i)
X.SH AUTHOR
XEric Gisin (egisin@waterloo.csnet)
e-o-f
echo Extracting text_ps.c
sed 's/^X//' > text_ps.c << 'e-o-f'
X/*
X * text-ps: convert text files to PostScript
X *
X *	Copyright (c) 1986, Eric Gisin, egisin@waterloo.CSNET
X *
X *	This program may be copied and redistributed, provided
X *	no fee is charged and this copyright notice is preserved.
X */
X
X#include <stdio.h>
X#include <ctype.h>
X
X#define	LLen	132
X#define	PLen	66
X
Xchar *	Head [] = {
X	"%!PS-Adobe-1.0",
X	"%%Creator: text_ps.c",
X	"%%DocumentFonts: Courier",
X	"/Courier findfont 12 scalefont setfont",
X	"/S {12 mul 780 exch sub 0 exch moveto show} def",
X	"/P+ {/Save save def M concat} def",
X	"/P- {showpage Save restore} def",
X	NULL};
Xchar *	Mdef [] = {"/M [1 0 0 1 18 0] def", "/M [0 -.727 0.727 0 21 737] def"};
X
Xint	wflag = 0;
Xint	page = 0;
X
Xmain(argc, argv)
X	char **	argv;
X{
X	int	i;
X	int	nofiles = 1;
X
X	for (i = 0; Head[i]!=NULL; i ++)
X		printf("%s\n", Head[i]);
X	for (i = 1; i < argc; i ++)
X	    if (argv[i][0]=='-')
X		switch (argv[i][1]) {
X		  case 'w':
X			wflag = !wflag;
X			break;
X		  default:
X			fprintf(stderr, "Usage: %s [-w] file ...\n", argv[0]);
X			exit(1);
X		}
X	    else {
X		FILE *	f;
X		nofiles = 0;
X		f = fopen(argv[i], "r");
X		if (f==NULL) {
X			fprintf(stderr, "%s: Can't open input %s\n", argv[0], argv[i]);
X			continue;
X		}
X		text_ps(f);
X		fclose(f);
X	    }
X	if (nofiles)
X		text_ps(stdin);
X}
X
Xtext_ps(f)
X	register FILE *	f;
X{
X	register c;
X	int	row = 0;
X	int	col = 0;
X	char	line [LLen+1];
X
X	printf("%s\n", Mdef[wflag]);
X	while (1) switch((c = getc(f))) {
X	  case EOF:
X	  case '\r':
X	  case '\n':
X	  case '\f':
X		if (c==EOF && row==0)
X			return;
X		if (row==0) {
X			page ++;
X			printf("%%%%Page: ? %d\n", page);
X			printf("P+\n");
X		}
X		if (col>0) {
X			line[(col<LLen) ? col : LLen] = '\0';
X			putstring(line);
X			printf("%d S\n", row);
X		}
X		if (c=='\n')
X			row ++;
X		if (row==PLen || c=='\f' || c==EOF) {
X			printf("P-\n");
X			row = 0;
X		}
X		if (c==EOF)
X			return;
X		col = 0;
X		break;
X	  case '\t':
X		while (col<LLen) {
X			line[col++] = ' ';
X			if (col%8 == 0) break;
X		}
X		break;
X	  case '\b':
X		if (col>0)
X			col --;
X		break;
X	  default:
X		if (col<LLen)
X			line[col++] = (isascii(c) && isprint(c)) ? c : ' ';
X	}
X}
X
Xputstring(s)
X	register char *s;
X{
X	register c;
X
X	putchar('(');
X	while ((c = *s++) != '\0') {
X		if (c=='\\' || c=='(' || c==')')
X			putchar('\\');
X		putchar(c);
X	}
X	putchar(')');
X}
X
e-o-f
echo Extracting prapple.com
sed 's/^X//' > prapple.com << 'e-o-f'
X$ ! Print text file on Apple LaserWriter
X$ !     pra*pple :== @disk$root:[local.apple.cmd]prapple
X$
X$       if P1 .eqs. "" then goto usage
X$       text_ps := $disk$root:[local.apple.cmd]text_ps
X$       define /user_mode sys$output sys$scratch:prapple.lis
X$       text_ps 'P1' 'P2' 'P3' 'P4' 'P5' 'P6' 'P7'
X$       print /queue=apple /form=postscript sys$scratch:prapple.lis /delete
X$       exit
X$ usage:
X$       write sys$error "Usage: prapple [-w] file ..."
X$       exit
e-o-f
exit 0

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

Date: Sat, 12 Apr 1986  18:24 EST
From: MARC%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU
Subject: Bit Smoothing on Apple Laserwriter?


Ken writes:

>>I would like to take the postscript output generated by a Mac including
>>output with bitmaps (say from macpaint) and print them on an Apple
>>Laserwriter not attached to Appletalk.  I currently have a postscript
>>header that can be prepended to Mac-generated postscript output, and
>>provides the necessary quickdraw definitions. It works on everything
>>except the bitmaps.

	
	The problem is in your PostScript header. The full header (I use 
one that was edited by Alan Crosswell,  Columbia U., available from the
info-mac archives) contains an encrypted segment at the end of it that 
contains the PostScript definitions for bit-smoothing. Note that this 
encrypted data contains additional PostScript code only, and that there is
no mechanism whereby PostScript can accept any sort of machine code. This
scheme is also used by Adobe in their implementation of downloadable fonts. 

--Marc

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

Date: Sat, 12 Apr 86 20:25:06 cst
From: hitchens@uo.cs.UTEXAS.EDU (Ron Hitchens, Sun Wiz)
Subject: Re:  Bit Smoothing on Apple Laserwriter?

  Yeah, we've done that here at UT.  It's no biggie.  What you need is
the laser-prep file which is downloaded by the Mac to prepare the LW
for receiving Mac Postscript files.  It has been posted to usenet
several times, both with and without the smoothing stuff.  The
smoothing algorithm is encoded hex, so it's opaque but it works fine.
The problem is that the hexified 68000 code is grokked by an eexec
command which reads to end-of-file, that makes it difficult to append
a Mac-prepared file to the end of it.

  The regular laser-prep file installs itself permanently in the LW so
that if you're mainly using it with a Mac it need only be downloaded
once.  Our LaserWriter is driven by a unix spooler (4.2) and is used
for ditroff and TeX mostly, only the occasional MacWrite or MacPaint
file is printed.  Laser-prep is quite large, so I didn't want it to be
continuosly resident.  I changed it to exist only for the current job
by removing the escape-from-server-loop stuff at the top and by making 
a small change to the encoded bit-smoothing data at the end.

  The end of the laser-prep file originally was something like this:

currentfile eexec
652E29AE551935C9A82086907FB876D510EC4D451220E0F80D63DBC0EA379346
(many lines of hex)
905B88019BC3EF0FF064AC6477442573C18EF7090E2C08EAA1A9

  The eexec would gooble hex digits until it hit EOF, I changed it to
look like this.

<652E29AE551935C9A82086907FB876D510EC4D451220E0F80D63DBC0EA379346
(many lines of hex)
905B88019BC3EF0FF064AC6477442573C18EF7090E2C08EAA1A9>
eexec

  All I've done here is define the large glob of hex as a string which is
pushed on the stack (by bounding it with <>).  Eexec happily uses the string
sitting on the stack rather than insisting on reading it from stdin.  What
this gains you is the ability to continue sending more Postscript following
the laser-prep which will be part of the same job.  When that job is finished
the whole shebang will be thrown away.  The penalty is that by pushing the
hex string on the stack that string space is wasted because PostScript
doesn't reclaim string space when they are popped off the stack.  It's
never caused a problem here however.

  So, to print a file prepared on a Mac, you just upload the PostScript
created by doing the CMD-P trick on the Mac.  Then concatenate the modified
laser-prep and your Mac file and feed it to lpr.  Presto, it prints just
like it would if you sent it via AppleTalk to a LaserWriter.  Here at
UT we've setup our spooler to prepend the laser-prep prolog if you spool
the Mac-generated file as a "fortran" type file (which was unused).  You
could also write a simple shell script something like this:

#!/bin/sh

cat /<somepath>/laser-prep.pro $@ | /usr/ucb/lpr -Plw

  I hope this helps.  The bit-smoothing function is very good and makes
a big difference when it's used.  

Ron Hitchens			University of Texas at Austin Computer Science
hitchens@uo.CS.UTEXAS.EDU	Ex-Text Processing Manager
ut-sally!hitchens		(What a relief.  Gimme Suns and leave me alone)

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

End of Info-Postscript for Laser Lovers Digest
**********************************************

cramer@kontron.UUCP.UUCP (07/15/86)

> Date:  Tue, 8 Apr 86 10:45 EST
> From:  "Roger C. King" <RCKing@MIT-MULTICS.ARPA>
> Subject:  Epson Printer Emulator Wanted
> 
> Does anyone have or know of an emulator which can run on either a PC or
> the LaserWriter which will emulate the text and graphics capabilities of
> an Epson (standard, now out of date, IBM Graphics) printer?  Such a
> program would do a lot to ease the interface of the LaserWriter family
> into the PC world.  Presumably such a program would support
> 'shift-PrtSc' for a graphics dump of the screen.
> 

I have a program written in C that converts Epson MX-80 sequences to
PostScript.  I'm currently working on a version that's all PostScript,
so it is transparent to the sending program.  Remind me about it in a
couple or three weeks, and I will let you know if it is done yet.

Clayton E. Cramer