[mod.computers.laser-printers] Programming LN03 question.

MRL%PFCVAX@MIT-ZERMATT.ARPA (12/12/85)

I'm looking for some help in programming an LN03.  I've been trying to use the
fonts that come with the machine in the opposite direction from what the
default is, i.e. specifying LANDSCAPE rather than PORTRAIT.  I was under the
impression that it would automatically rotate the font, assuming that there was
enough memory.  However, it is not working (all I get out is black boxes for
characters).  Is there some magic command I should be using?  (I hope it
doesn't mean I have to buy the extra memory module!).  Thanks. 
							Mark London

laser-lovers@ucbvax.UUCP (12/14/85)

> I'm looking for some help in programming an LN03.  I've been trying to use the
> fonts that come with the machine in the opposite direction from what the
> default is, i.e. specifying LANDSCAPE rather than PORTRAIT.  I was under the
> impression that it would automatically rotate the font, assuming that there was
> enough memory.  However, it is not working (all I get out is black boxes for
> characters).  Is there some magic command I should be using?  (I hope it
> doesn't mean I have to buy the extra memory module!).  Thanks. 
> 							Mark London

The escape sequence I have used to print in landscape mode is:

	<ESC>[1 J

We do have an extra RAM cartridge, but I used this escape sequence
before we got the RAM cartridge and it worked.  There are some
limitations on how much data you can print without the RAM cartridge.

John Pew
Silicon Compilers
...{weitek,decwrl,oliveb}!sci!johnp

laser-lovers@ucbvax.UUCP (12/15/85)

In article <8512121657.AA13245@ucbvax.berkeley.edu> MRL%PFCVAX@MIT-ZERMATT.ARPA writes:
>I'm looking for some help in programming an LN03.  I've been trying to use the
>fonts that come with the machine in the opposite direction from what the
>default is, i.e. specifying LANDSCAPE rather than PORTRAIT.
>							Mark London


I have this feeling that the extra memory module is exactly what you need.  We
have several LN03's at Commodore used mostly for word processing and in place
of a line printer on our unix system.  I have no complaints about the LN03's butthe preliminary manual they were shipped with has to set a new low for utility.
It gives all the details, but tells you nothing.  I guess they assume that you
just read a LN03 concepts and features manual or something.

Anyway, I am not sure how to do what you want, however I would like to offer
this little filter that I wrote.  It allows you to select one of the two ?nn
fonts that seem to be intended as default fonts for portrait or landscape mode
printer emulation.  If anyone knows how to make the printer power up with these
modes I would really like to hear about it.

The program acts a standard unix filter, meaning it can be used to print a file
directly on the printer, or piped in between pr and lpr.  It processes the
command line sequentially.  When it sees a -P or -L switch, it sends a control
string to switch to portrait or landscape mode respectivly.  When it sees a
file name, it copies the file to stdout.  If no file names were specified, it
copies stdin to stdout, and finally sends the string to reset the printer to
default power-up format.

I had originally intended to implement lots of switches to allow specifying all
the various printer parameters, but found that the -P and -L choices did all
that I needed, so I quit while I was ahead.  Use of getopt would probably make
the program much simpler, but I was blissfully unaware of that flamewar when I
wrote this.

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

/*
 *	ln03	A simple filter to make a DEC LN03 into usable printer...
 *
 *	ln03 -P file...			Portrait Mode
 *	ln03 -L file...			Landscape Mode
 *	ln03	file...			Why Bother
 *
 *	No Rights reserved, this program is cast upon thee winds of fate since
 *	it took longer to figure out the LN03 manual than to write the program.
 *
 *	George Robbins 9/85 - ihnp4!cbm!grr
 *
 */

#include <stdio.h>

int	didfile;

main(argc,argv)
	int	argc;
	char	*argv[];
{
	int	argn;

	didfile = 0;
	for (argn = 1; argn < argc; )
		argn = doarg(argc, argv, argn);
	if (didfile == 0)
		dostdin();
	printf("\033[!p");
	fflush(stdout);
}

int
doarg(argc, argv, argn)
	int	argc;
	char	*argv[];
	int	argn;
{
	char	*argp;
	char	argl;

	argp = argv[argn++];
	if (*argp++ != '-') {
		dofile(--argp);
		didfile++;
	} else
		while(argl = *argp++)
			argn = doswitch(argc, argv, argn, argl);
	return(argn);
}

int
doswitch(argc, argv, argn, argl)
	int	argc;
	char	*argv;
	int	argn;
	char	argl;
{
	int	targ;

	switch(argl) {
	case 'L':
		printf("\033[?21 J\010\033[15m\033[5;255s");
		break;
	case 'P':
		printf("\033[?20 J\010\033[12m\033[13;255s");
		break;
	case 'l':
	case 'p':
	default:
		fprintf(stderr,"invalid switch -%c\n",argl);
	}
	return(argn);
}

int
dofile(argp)
	char	*argp;
{
	FILE	*input;
	int	c;

	if (input = fopen(argp, "r")) {
		while ((c = fgetc(input)) != EOF)
			putchar(c);
		fclose(input);
	} else
		fprintf(stderr,"can't open %s\n",argp);
}

dostdin()
{
	int	c;
	while ((c = getchar()) != EOF)
		putchar(c);
}


-- 
George Robbins			uucp:	{unirot|tapa}!grr
P.O. Box 177
Lincoln U, PA  19352	[Any ideas herein are not responsible for themselves!]
---
George Robbins			uucp:	{unirot|tapa}!grr
P.O. Box 177
Lincoln U, PA  19352	[Any ideas herein are not responsible for themselves!]

crl@NEWTON.PURDUE.EDU (Charles R. LaBrec) (12/16/85)

From experience at our site with both troff and TeX, if you have an
LN03, you had better plan on buying two RAM cartridges.  With none,
you only have about 28K available, and I doubt if you could even load
two 10-point fonts.  With only one, you must plan on having to delete
fonts during the printing of a document, and my experience with this
is that there seems to be a bug in the LN03 that sometimes screws up
the fonts if you start deleting them.  By the way, my overall
impression of the LN03 is quite favorable.  The quality of the output
is extremely good, even after 9000 copies on the original OPC belt
cartridge.  For you programmers, here are some anomalies I've noted in
the unit that are either not clearly addressed in the manual, or are
wrong, at least as I understand it, so if your unit doesn't exhibit
it, I'd be glad to hear from you.

1) Setting DECOPM so that coords are relative to the physical page
instead of the edge of the printable page does not work.

2) If you create fonts, note that the LN03 truncates rather than
rounds the conversion from decipoints (Gutenbergs, depending on your
version of the manual) to pixels.

3) The first coord on a page is (1,1), not (0,0).

Charles LaBrec
crl @ newton.PURDUE.EDU