Artifact 7f77f27bc151d33a8e2c2f6455bc8bd88c3ac9f2db177483db8c481e2b775907:


/*
 * $Id: hpgl.trm,v 3.26 92/03/24 22:34:56 woo Exp Locker: woo $
 */

/* GNUPLOT - hpgl.trm */
/*
 * Copyright (C) 1990, 1991, 1992   
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted, 
 * provided that the above copyright notice appear in all copies and 
 * that both that copyright notice and this permission notice appear 
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the modified code.  Modifications are to be distributed 
 * as patches to released version.
 *  
 * This software  is provided "as is" without express or implied warranty.
 * 
 * This file is included by ../term.c.
 *
 * This terminal driver supports:
 *  hpgl, hp7580b, HP Laserjet III
 *
 * AUTHORS
 *  Colin Kelley, Thomas Williams, Russell Lang
 * 
 * send your comments or suggestions to (info-gnuplot@ames.arc.nasa.gov).
 * 
 */

#define HPGL_XMAX 15200
#define HPGL_YMAX 10000

#define PCL_XMAX 10000
#define PCL_YMAX  7500

#define HPGL_XLAST (HPGL_XMAX - 1)
#define HPGL_YLAST (HPGL_XMAX - 1)

/* HPGL_VCHAR, HPGL_HCHAR  are not used */
#define HPGL_VCHAR	(HPGL_YMAX/100*32/10) /* 3.2% */
#define HPGL_HCHAR	(HPGL_XMAX/100*12/10) /* 1.2% */
#define HPGL_VTIC	(HPGL_YMAX/70)		
#define HPGL_HTIC	(HPGL_YMAX/70)		

#define PCL_VCHAR	(PCL_YMAX/100*32/10) /* 3.2% */
#define PCL_HCHAR	(PCL_XMAX/100*12/10) /* 1.2% */
#define PCL_VTIC	(PCL_YMAX/70)		
#define PCL_HTIC	(PCL_YMAX/70)		

int HPGL_ang = 0;

HPGL_init()
{
	fputs("\033.Y\n",outfile);
/*	       1
	1. enable eavesdropping
*/
}

PCL_PORT_init()
{
  	fputs("\033E\033&l1X\033&l0O\033&2A\033%0B;PW0.15\n",outfile);
/*           1      2       3       4     5     6
	1. reset the printer
	2. one copy
	3. portrait orientation
	4. use letter paper
	5. enter HP-GL/2 with old pen position
	6. Pen Width
*/
}

PCL_LAND_init()
{
	fputs("\033E\033&l1X\033&l1O\033%0B;PW0.15\n",outfile);
/*
                 1      2       3       4     5
	1. reset the printer
	2. one copy
	3. landscape orientation
	4. enter HP-GL/2 with old pen position
	5. Pen Width
*/
}


PCL_graphics()
{
	fprintf(outfile,
	"\033%0B\nIN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
		PCL_XMAX,PCL_YMAX,
		((double)(PCL_HCHAR)*200/3/PCL_XMAX),
		((double)(PCL_VCHAR)*100/2/PCL_YMAX) );
/*	 0         1    2             3 
	0. enter HPGL/2 mode
	1. reset to power-up defaults
	2. set SCaling
	3. set character size
*/
	HPGL_ang = 0;
}

HPGL_graphics()
{
	fprintf(outfile,
	"IN;\nSC0,%d,0,%d;\nSR%f,%f;\n",
		HPGL_XMAX,HPGL_YMAX,
		((double)(HPGL_HCHAR)*200/3/HPGL_XMAX),
		((double)(HPGL_VCHAR)*100/2/HPGL_YMAX) );
/*	 1    2             3 
	1. reset to power-up defaults
	2. set SCaling
	3. set character size
*/
	HPGL_ang = 0;
}


PCL_text()
{
	fputs("PU;\nSP0;\n\033.Z\0",outfile);
/*	       1    2     3
	1. pen up
	2. park pen
	3. disable eavesdropping
*/
	fputs("\n\033%1A\n\033&l0H\0",outfile);
/*	           1    2      3
	1. enter PCL
	2. eject page
	3. reset printer
*/
}

HPGL_text()
{
	fputs("PU;\nSP0;\n\033.Z\0",outfile);
/*	       1    2     3
	1. pen up
	2. park pen
	3. disable eavesdropping
*/
}


HPGL_linetype(linetype)
int linetype;
{
/* allow for 6 pens */
	fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%6+1); 
}


HP75_linetype(linetype)
int linetype;
{
/* allow for 4 pens */
	fprintf(outfile,"PU;\nSP%d;\n",(linetype+2)%4+1); 
}


/* some early HPGL plotters (e.g. HP7220C) require the
 * Pen Up/Down and Pen (move) Absolute commands to be separate
 */
HPGL_move(x,y)
int x,y;
{
	fprintf(outfile,"PU;PA%d,%d;\n",x,y);
}


HPGL_vector(x,y)
int x,y;
{
	fprintf(outfile,"PD;PA%d,%d;\n",x,y);
}


HPGL_put_text(x,y,str)
int x, y;
char *str;
{
	if (HPGL_ang == 1)
		HPGL_move(x + HPGL_VCHAR/4,y);
	else
		HPGL_move(x,y - HPGL_VCHAR/4);
	fprintf(outfile,"LB%s\003\n",str);
}

PCL_put_text(x,y,str)
int x, y;
char *str;
{
        if (HPGL_ang == 1)
                HPGL_move(x + PCL_VCHAR/4,y);
        else
                HPGL_move(x,y - PCL_VCHAR/4);
        fprintf(outfile,"LB%s\003\n",str);
}


int HPGL_text_angle(ang)
int ang;
{
	HPGL_ang = ang;
	if (ang == 1)
		/* vertical */
		fprintf(outfile,"DI0,1;\n");
	else
		/* horizontal */
		fprintf(outfile,"DI1,0;\n");
	return TRUE;
}

HPGL_reset()
{
       fprintf(outfile,"PG;\n");
       /*  This HPGL command is ignored in HPGL/2 */
}


PCL_reset()
{
	fputs("\033%0A\033&l0H\033E\n",outfile);
/*         PCL mode   eject reset  */
}


REDUCE Historical
REDUCE Sourceforge Project | Historical SVN Repository | GitHub Mirror | SourceHut Mirror | NotABug Mirror | Chisel Mirror | Chisel RSS ]