v08i023: xfig -- X Drawing Tool, Part14/21

Brian V. Smith envbvs at epb2.lbl.gov
Wed Jul 4 04:01:43 AEST 1990


Submitted-by: envbvs at epb2.lbl.gov (Brian V. Smith)
Posting-number: Volume 8, Issue 23
Archive-name: xfig2.8/part14

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 14 (of 21)."
# Contents:  f2ps.c xfig.man
# Wrapped by envbvs at epb2.lbl.gov on Thu Jun 28 08:52:56 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'f2ps.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'f2ps.c'\"
else
echo shar: Extracting \"'f2ps.c'\" \(20408 characters\)
sed "s/^X//" >'f2ps.c' <<'END_OF_FILE'
X/* 
X *	F2ps : Fig-to-PostScript translator
X *
X *	Copyright (c) 1986 by Supoj Sutanthavibul (supoj at sally.UTEXAS.EDU)
X *	June 1986.
X *	1st revision : March 1988 - read fig 1.4 or 1.4X format
X *
X *	Version 2.0 additions (protocol 1.4X) by B.V. Smith 2/90
X *
X *	%W%	%G%
X*/
X#include "fig.h"
X#include "object.h"
X#include "resources.h"
X#include "psfonts.h"
X
X#define		PAGE_WIDTH		612	/* points; 8.5" */
X#define		PAGE_HEIGHT		792	/* points; 11" */
X#define		POINT_PER_INCH		72
X#define		DEFAULT_FONT_SIZE	11
X#define		DEFAULT_FONT		"Times-Roman"
X
Xextern	struct _fstruct fontnames[];	/* printer font names */
X
Xchar		Usage[] = "Usage: %s [-P][-L][-f font][-s size][-e scale][-N][-c] [input [output]]\n";
Xchar		*prog;
Xchar		*font = DEFAULT_FONT;
Xint		font_size = DEFAULT_FONT_SIZE;
Xint		cur_thickness;
Xint		cur_areafill=0;
Xint		show_page = 1;
Xint		center = 0;
Xint		landscape = 1;
Xdouble		scale = 1.0;
Xdouble		reduction;	/* converts screen ppi to printer points */
Xextern int	num_object;
Xchar		*from = NULL, *to = NULL;
XFILE		*tfp = NULL;
Xchar		Err_incomp[] = "Incomplete %s object at line %d.";
Xchar		Err_mem[] = "Running out of memory.";
X
Xint		line_thickness; /* not needed for f2ps, arrow.c needs it for fig */
X
Xget_args(argc, argv)
Xint	 argc;
Xchar	*argv[];
X{
X	char	*a;
X	int	first = 1;
X
X	prog = *argv;
X	while (--argc) {
X	    a = *++argv;
X	    if (*a == '-') {
X		if (*++a == 'f') {	/* Font name followed */
X		    if (--argc)
X			font = *++argv;
X		    else
X			goto error_exit;
X		    }
X		else if (*a == 'c') {	/* Centering */
X		    center = 1;
X		    }
X		else if (*a == 'l' || *a == 'L') {	/* Landscape */
X		    landscape = 1;
X		    }
X		else if (*a == 'p' || *a == 'P') {	/* Portrait */
X		    landscape = 0;
X		    }
X		else if (*a == 's') {	/* Font size followed */
X		    if (--argc) {
X			font_size = atoi(*++argv);
X			}
X		    else
X			goto error_exit;
X		    }
X		else if (*a == 'e') {	/* Enlarging factor followed */
X		    if (--argc)
X			scale = atof(*++argv);
X		    else
X			goto error_exit;
X		    }
X		else if (*a == 'N') {	/* No "showpage" */
X		    show_page = 0;
X		    }
X		else
X		    goto error_exit;
X		}
X	    else if (first) {
X		from = a;	/*  from file  */
X		first = 0;
X		}
X	    else if (first == 0) {
X		to = a;		/*  to file  */
X		first = -1;
X		}
X	    else
X		goto error_exit;
X	    }
X	return;
X
X    error_exit:
X	fprintf(stderr, Usage, prog);
X	exit(1);
X	}
X
Xmain(argc, argv)
Xint	 argc;
Xchar	*argv[];
X{
X	F_compound	objects;
X	int		status;
X
X	get_args(argc, argv);
X
X	if (to == NULL)
X	    tfp = stdout;
X	else if ((tfp = fopen(to, "w")) == NULL) {
X	    fprintf(stderr, "%s: Couldn't open %s", prog, to);
X	    fprintf(stderr, Usage, prog);
X	    exit(1);
X	    }
X
X	if (from)
X	    status = read_fig(from, &objects);
X	else 	/* read from stdin */
X	    status = readfp_fig(stdin, &objects);
X
X	if (status != 0) {
X	    if (from) read_fail_message(from, status);
X	    exit(1);
X	    }
X	genps_objects(&objects);
X	if (tfp != stdout) (void)fclose(tfp);
X	exit(0); }
X
X#define		BEGIN_PROLOG	"\
X/$F2psDict 32 dict def \
X$F2psDict begin\
X $F2psDict /mtrx matrix put\
X"
X#define		ELLIPSE_PS	" \
X/DrawEllipse {\
X /endangle exch def\
X /startangle exch def\
X /yrad exch def\
X /xrad exch def\
X /y exch def\
X /x exch def\
X /savematrix mtrx currentmatrix def\
X x y translate xrad yrad scale 0 0 1 startangle endangle arc\
X savematrix setmatrix\
X } def\
X"
X#define		SPLINE_PS	" \
X/DrawSplineSection {\
X /y3 exch def\
X /x3 exch def\
X /y2 exch def\
X /x2 exch def\
X /y1 exch def\
X /x1 exch def\
X /xa x1 x2 add 2 div def\
X /ya y1 y2 add 2 div def\
X /xb x2 x3 add 2 div def\
X /yb y2 y3 add 2 div def\
X /x2 xa xb add 2 div def\
X /y2 ya yb add 2 div def x1 x2 sub abs 2 lt y1 y2 sub abs 2 lt and\
X  { x2 y2 lineto }\
X  { x2 y2 xb yb x3 y3 x1 y1 xa ya x2 y2 DrawSplineSection\
X  /y3 exch def\
X  /x3 exch def\
X  /yb exch def\
X  /xb exch def\
X  /y2 exch def\
X  /x2 exch def}\
X ifelse\
X x2 x3 sub abs 2 lt y2 y3 sub abs 2 lt and { x3 y3 lineto }\
X { x2 y2 xb yb x3 y3 DrawSplineSection } ifelse\
X } def\
X"
X#define		END_PROLOG	"\
X end\
X /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def\
X /$F2psEnd {$F2psEnteredState restore end} def\
X\n%%EndProlog\
X"
X
X#define		MAX	32000
X#define		MIN	-32000
Xstatic int	coord_system;
Xstatic int	llx = MAX, lly = MAX, urx = MIN, ury = MIN;
X
Xprolog(objects)
XF_compound	*objects;
X{
X	char		host[256];
X	struct passwd	*who;
X	long		when;
X	extern char	*ctime(), *strcpy();
X	extern long	time();
X
X	fprintf(tfp, "%%!\n");	/* PostScript magic strings */
X	who = getpwuid(getuid());
X	if (-1 == gethostname(host, sizeof(host)))
X	    (void)strcpy(host, "unknown-host!?!?");
X	(void) time(&when);
X	fprintf(tfp, "%%%%Title: %s\n", ((from) ? from : "stdin"));
X	fprintf(tfp, "%%%%Creator: %s\n", prog);
X	fprintf(tfp, "%%%%CreationDate: %s", ctime(&when));
X	fprintf(tfp, "%%%%For: %s@%s (%s)\n",
X			who->pw_name, host, who->pw_gecos);
X	fprintf(tfp, "%%%%Pages: %d\n", show_page);
X      fprintf(tfp, "%%%%BoundingBox: %d %d %d %d\n", llx, lly, urx, ury);
X	fprintf(tfp, "%%%%EndComments\n");
X	fprintf(tfp, "%s\n", BEGIN_PROLOG);
X	if (ellipse_exist(objects)) 
X		fprintf(tfp, "%s\n", ELLIPSE_PS);
X	if (normal_spline_exist(objects)) 
X		fprintf(tfp, "%s\n", SPLINE_PS);
X	fprintf(tfp, "%s\n", END_PROLOG);
X	fprintf(tfp, "$F2psBegin\n");
X	}
X
Xepilog()
X{
X	if (show_page) fprintf(tfp, "showpage\n");
X	fprintf(tfp, "$F2psEnd\n");
X	}
X
Xgenps_objects(objects)
XF_compound	*objects;
X{
X      double          scalex, scaley;
X      double          origx, origy, dx, dy;
X	F_arc		*a;
X	F_compound	*c;
X	F_ellipse	*e;
X	F_line		*l;
X	F_spline	*s;
X	F_text		*t;
X	int		fill;
X	int		itmp;
X
X	/* Compute bounding box of objects */
X	compound_bound(objects, &llx, &lly, &urx, &ury);
X	if (llx > urx) {
X	    fprintf(stderr, "%s: No object",prog);
X	    return;
X	    }
X      /* calculate reduction:
X              convert screen points-per-inch to printer points */
X	reduction = POINT_PER_INCH / (float)objects->nwcorner.x;
X	scalex = scaley = scale * reduction;
X      coord_system = objects->nwcorner.y;
X      if (coord_system == 2) {
X              scaley = -scaley;
X              itmp = lly; lly = ury; ury = itmp;
X              }
X	/* convert to point unit */
X	llx = (int)ceil(llx * scalex);
X	lly = (int)ceil(lly * scaley);
X	urx = (int)ceil(urx * scalex);
X	ury = (int)ceil(ury * scaley);
X      /* rotate bounding box if landscape mode */
X      if (landscape) {
X              itmp = ury; ury = -llx; llx = lly;
X              lly = -urx; urx = itmp;
X		}
X      /* center bounding box in page */
X	if (center) {
X              origx = -llx;
X              origy = -lly;
X
X              dx = abs (urx - llx);
X              dy = abs (ury - lly);
X              llx = (PAGE_WIDTH - dx) / 2.0;
X              lly = (PAGE_HEIGHT - dy) / 2.0;
X              urx = llx + dx;
X              ury = lly + dy;
X              origx += llx;
X              origy += lly;
X              }
X	prolog(objects);
X
X      /* center image on page */
X      if (center)
X              fprintf(tfp, "%f %f translate\n", origx, origy);
X
X      /* scale image (=> "flip" if origin changing) */
X      fprintf(tfp, "%f %f scale\n", scalex, scaley);
X      /* rotate image if landscape mode */
X      if (landscape)
X              fprintf(tfp, "90 rotate\n");
X
X	/* make first pass with area-filled objects; second with non-filled */
X	for (fill=1; fill>=0; fill--)
X		{
X		for (a = objects->arcs; a != NULL; a = a->next) 
X			genps_arc(a,fill);
X		for (c = objects->compounds; c != NULL; c = c->next) 
X			genps_compound(c,fill);
X		for (e = objects->ellipses; e != NULL; e = e->next) 
X			genps_ellipse(e,fill);
X		for (l = objects->lines; l != NULL; l = l->next) 
X			genps_line(l,fill);
X		for (s = objects->splines; s != NULL; s = s->next) 
X			genps_spline(s,fill);
X		}
X	/* do text after everything else */
X	for (t = objects->texts; t != NULL; t = t->next) 
X		genps_text(t);
X	epilog();
X	}
X
Xset_style(s, v)
Xint	s;
Xfloat	v;
X{
X	if (s == DASH_LINE) {
X	    if (v > 0.0) fprintf(tfp, "\t[%f] 0 setdash\n", v);
X	    }
X	else if (s == DOTTED_LINE) {
X	    if (v > 0.0) fprintf(tfp, "\t[1 %f] 0 setdash\n", v);
X	    }
X	}
X
Xreset_style(s, v)
Xint	s;
Xfloat	v;
X{
X	if (s == DASH_LINE) {
X	    if (v > 0.0) fprintf(tfp, "\t[] 0 setdash\n");
X	    }
X	else if (s == DOTTED_LINE) {
X	    if (v > 0.0) fprintf(tfp, "\t[] 0 setdash\n");
X	    }
X	}
X
Xset_areafill(a)
Xint a;
X{
X	if (cur_areafill != a)
X		{
X		cur_areafill = a;
X		fprintf(tfp, "%.2f setgray\n",1.0-(a-1.0)/(NUMFILLPATS-1.0));
X		}
X	}
X
Xset_linewidth(w)
Xint	w;
X{
X	extern int	cur_thickness;
X
X	if (w != cur_thickness) {
X	    cur_thickness = w;
X	    fprintf(tfp, "%.3f setlinewidth\n", /* 0.7 * */ 1.0 * cur_thickness);
X	    }
X	}
X
Xgenps_compound(com,fill)
XF_compound	*com;
Xint fill;
X{
X	F_arc		*a;
X	F_compound	*c;
X	F_ellipse	*e;
X	F_line		*l;
X	F_spline	*s;
X	F_text		*t;
X
X	for (a = com->arcs; a != NULL; a = a->next) 
X		genps_arc(a,fill);
X	for (c = com->compounds; c != NULL; c = c->next) 
X		genps_compound(c,fill);
X	for (e = com->ellipses; e != NULL; e = e->next) 
X		genps_ellipse(e,fill);
X	for (l = com->lines; l != NULL; l = l->next) 
X		genps_line(l,fill);
X	for (s = com->splines; s != NULL; s = s->next) 
X		genps_spline(s,fill);
X	if (fill==0)	/* no filled text, just do text on the non-filled pass */
X		for (t = com->texts; t != NULL; t = t->next) 
X			genps_text(t);
X	}
X
Xgenps_line(l,fill)
XF_line	*l;
Xint fill;
X{
X	F_point		*p, *q;
X	int		radius;
X
X	if ((fill && l->area_fill==0) ||
X	    (fill==0 && l->area_fill))
X		return;
X
X	set_linewidth(l->thickness);
X	radius = l->radius;		/* radius of rounded-corner boxes */
X	p = l->points;
X	q = p->next;
X	if (q == NULL) { /* A single point line */
X	    if (l->thickness > 0)
X		fprintf(tfp, "newpath %d %d moveto %d %d lineto stroke\n",
X			p->x, p->y, p->x, p->y);
X	    else
X		fprintf(tfp, "newpath %d %d moveto %d %d lineto\n",
X			p->x, p->y, p->x, p->y);
X	    return;
X	    }
X	if (l->back_arrow)
X	    draw_arrow_head((float)q->x, (float)q->y, (float)p->x,
X			(float)p->y, l->back_arrow->ht, l->back_arrow->wid);
X	set_style(l->style, l->style_val);
X	fprintf(tfp, "%% Polyline\n");
X	if (l->type == T_ARC_BOX)	/* rounded-corner box */
X		{
X		register int xmin,xmax,ymin,ymax;
X
X		xmin = xmax = p->x;
X		ymin = ymax = p->y;
X		while (p->next != NULL)	/* find lower left and upper right corners */
X			{
X			p=p->next;
X			if (xmin > p->x)
X				xmin = p->x;
X			else if (xmax < p->x)
X				xmax = p->x;
X			if (ymin > p->y)
X				ymin = p->y;
X			else if (ymax < p->y)
X				ymax = p->y;
X			}
X		fprintf(tfp, "newpath %d %d moveto",xmin+radius, ymin);
X		fprintf(tfp, " %d %d %d %d %d arcto 4 {pop} repeat",
X				xmin, ymin, xmin, ymax-radius, radius);
X		fprintf(tfp, " %d %d %d %d %d arcto 4 {pop} repeat", /* arc through bl to br */
X				xmin, ymax, xmax-radius, ymax, radius);
X		fprintf(tfp, " %d %d %d %d %d arcto 4 {pop} repeat", /* arc through br to tr */
X				xmax, ymax, xmax, ymin+radius, radius);
X		fprintf(tfp, " %d %d %d %d %d arcto 4 {pop} repeat", /* arc through tr to tl */
X				xmax, ymin, xmin+radius, ymin, radius);
X		}
X	else
X		{
X		fprintf(tfp, "newpath %d %d moveto", p->x, p->y);
X		while (q->next != NULL) {
X		    p = q;
X		    q = q->next;
X		    fprintf(tfp, " %d %d lineto", p->x, p->y);
X		    }
X		}
X	if (l->type == T_POLYLINE)
X	    {
X	    if (l->thickness > 0)
X		fprintf(tfp, " %d %d lineto stroke\n", q->x, q->y);
X	    else
X		fprintf(tfp, " %d %d lineto\n", q->x, q->y);
X	    }
X	else
X	    {
X	    fprintf(tfp, " closepath ");
X	    if (l->area_fill)
X		{
X		set_areafill(l->area_fill);
X		fprintf(tfp, " gsave fill grestore ");
X		set_areafill(NUMFILLPATS);	/* back to black line */
X		}
X	    if (l->thickness > 0)
X		fprintf(tfp, " stroke\n");
X	    }
X
X	reset_style(l->style, l->style_val);
X	if (l->for_arrow && l->thickness > 0)
X	    draw_arrow_head((float)p->x, (float)p->y, (float)q->x,
X			(float)q->y, l->for_arrow->ht, l->for_arrow->wid);
X	}
X
Xgenps_spline(s,fill)
XF_spline	*s;
Xint fill;
X{
X	if (int_spline(s))
X	    genps_itp_spline(s,fill);
X	else
X	    genps_ctl_spline(s,fill);
X	}
X
Xgenps_itp_spline(s,fill)
XF_spline	*s;
Xint fill;
X{
X	F_point		*p, *q;
X	F_control	*a, *b;
X
X	if ((fill && s->area_fill==0) ||
X	    (fill==0 && s->area_fill))
X		return;
X
X	set_linewidth(s->thickness);
X	a = s->controls;
X	b = a->next;
X	p = s->points;
X	if (s->back_arrow && s->thickness > 0)
X	    draw_arrow_head(b->lx, b->ly, (float)p->x,
X			(float)p->y, s->back_arrow->ht, s->back_arrow->wid);
X
X	set_style(s->style, s->style_val);
X	fprintf(tfp, "%% Interpolated spline\n");
X	fprintf(tfp, "newpath %d %d moveto\n", p->x, p->y);
X	for (q = p->next; q != NULL; p = q, q = q->next) {
X	    b = a->next;
X	    fprintf(tfp, "\t%.3f %.3f %.3f %.3f %d %d curveto\n",
X			a->rx, a->ry, b->lx, b->ly, q->x, q->y);
X	    a = b;
X	    }
X	if (closed_spline(s)) 
X		{
X		fprintf(tfp, " closepath ");
X		if (s->area_fill)
X			{
X			set_areafill(s->area_fill);
X			fprintf(tfp, " gsave fill grestore ");
X			set_areafill(NUMFILLPATS);	/* back to black for line */
X			}
X		}
X	if (s->thickness > 0)
X	    fprintf(tfp, " stroke\n");
X	reset_style(s->style, s->style_val);
X
X	if (s->for_arrow && s->thickness > 0)
X	    draw_arrow_head(a->lx, a->ly, (float)p->x,
X			(float)p->y, s->for_arrow->ht, s->for_arrow->wid);
X	}
X
Xgenps_ctl_spline(s,fill)
XF_spline	*s;
Xint fill;
X{
X	float		a, b, c, d, x1, y1, x2, y2, x3, y3;
X	F_point		*p, *q;
X
X	/*
X	if (first) {
X	    first = FALSE;
X	    fprintf(tfp, "%s\n", SPLINE_PS);
X	    }
X	*/
X
X	if ((fill && s->area_fill==0) ||
X	    (fill==0 && s->area_fill))
X		return;
X
X	p = s->points;
X	x1 = p->x; y1 = p->y;
X	p = p->next;
X	c = p->x; d = p->y;
X	set_linewidth(s->thickness);
X	x3 = a = (x1 + c) / 2;
X	y3 = b = (y1 + d) / 2;
X	if (s->back_arrow && s->thickness > 0) {
X	    draw_arrow_head(c, d, x1, y1, s->back_arrow->ht, s->back_arrow->wid);
X	    }
X	set_style(s->style, s->style_val);
X	if (! closed_spline(s)) {
X	    fprintf(tfp, "%% Open spline\n");
X	    fprintf(tfp, "newpath %.3f %.3f moveto %.3f %.3f lineto\n",
X			x1, y1, x3, y3);
X	    }
X	else {
X	    fprintf(tfp, "%% Closed spline\n");
X	    fprintf(tfp, "newpath %.3f %.3f moveto\n", a, b);
X	    }
X	for (q = p->next; q != NULL; q = q->next) {
X	    x1 = x3; y1 = y3;
X	    x2 = c;  y2 = d;
X	    c = q->x; d = q->y;
X	    x3 = (x2 + c) / 2;
X	    y3 = (y2 + d) / 2;
X	    fprintf(tfp, "\t%.3f %.3f %.3f %.3f %.3f %.3f DrawSplineSection\n",
X			x1, y1, x2, y2, x3, y3);
X	    }
X	/*
X	* At this point, (x2,y2) and (c,d) are the position of the 
X	* next-to-last and last point respectively, in the point list
X	*/
X	if (closed_spline(s)) {
X	    fprintf(tfp, "\t%.3f %.3f %.3f %.3f %.3f %.3f DrawSplineSection closepath ",
X			x3, y3, c, d, a, b);
X	    if (s->area_fill)
X		{
X		set_areafill(s->area_fill);
X		fprintf(tfp, " gsave fill grestore\n");
X		set_areafill(NUMFILLPATS);	/* back to black for line */
X		}
X	    if (s->thickness > 0)
X		fprintf(tfp, " stroke\n");
X	    }
X	else {
X	    if (s->thickness > 0)
X		fprintf(tfp, "\t%.3f %.3f lineto stroke\n", c, d);
X	    else
X		fprintf(tfp, "\t%.3f %.3f lineto\n", c, d);
X	    }
X	reset_style(s->style, s->style_val);
X	if (s->for_arrow && s->thickness > 0) 
X	    {
X	    draw_arrow_head(x2, y2, c, d, s->for_arrow->ht,
X				s->for_arrow->wid);
X	    }
X	}
X
Xgenps_ellipse(e,fill)
XF_ellipse	*e;
Xint fill;
X{
X	if ((fill && e->area_fill==0) ||
X	    (fill==0 && e->area_fill))
X		return;
X
X	set_linewidth(e->thickness);
X	set_style(e->style, e->style_val);
X	fprintf(tfp, "%% Ellipse\n");
X	fprintf(tfp, "newpath %d %d %d %d 0 360 DrawEllipse\n",
X		e->center.x, e->center.y, e->radiuses.x, e->radiuses.y);
X	if (e->area_fill)
X		{
X		set_areafill(e->area_fill);
X		fprintf(tfp, " gsave fill grestore\n");
X		set_areafill(NUMFILLPATS);	/* back to black for line */
X		}
X	if (e->thickness > 0)
X	    fprintf(tfp, " stroke\n");
X	reset_style(e->style, e->style_val);
X	}
X
X#define	TEXT_SET_PS	"\
Xfn%d.%d setfont\n\
X"
X#define TEXT_DEF_PS	"\
X/fn%d.%d /%s findfont %f scalefont def\n\
X"
X
X#define MAX_FONT_SIZES 20
X
Xgenps_text(t)
XF_text	*t;
X	{
X	char	*c;
X	static	int current_font = -1;
X	static	int current_size = -1;
X	static	int first[NUMFONTS][MAX_FONT_SIZES];
X	int	i,j,found;
X
X	if (current_font == -1)
X		for (i=0; i<NUMFONTS; i++)
X		    for (j=0; j<MAX_FONT_SIZES; j++)
X			first[i][j] = 0;
X
X	/* if different font or different size, choose new */
X	if (current_font != t->font || current_size != t->size)
X	    {
X	    found = FALSE;
X	    for (i=0; (first[t->font][i]!=0 && i<MAX_FONT_SIZES); i++)
X		if (first[t->font][i] == t->size)	/* look for this size */
X		    {
X		    found = TRUE;
X		    break;
X		    }
X	    if (!found)		/* if we haven't already done a 'findfont'... */
X		{
X		fprintf(tfp, TEXT_DEF_PS, t->font, t->size, fontnames[t->font].psfont, 
X					t->size/reduction);
X		if (i < MAX_FONT_SIZES)		/* insert this size in table */
X		    first[t->font][i] = t->size;
X		}
X	    fprintf(tfp, TEXT_SET_PS, t->font, t->size); /* now select the font */
X	    }
X	current_font = t->font;
X	current_size = t->size;
X
X	fprintf(tfp,"(");
X	for (c = t->cstring; *c; c++) 		/* push the string on the stack */
X	    {
X	    if (*c == '\\' || *c == '(' || *c == ')') 
X		putc('\\', tfp);
X	    putc(*c, tfp);
X	    }
X
X	if (t->type == T_CENTER_JUSTIFIED || t->type == T_RIGHT_JUSTIFIED)
X		{
X		/* dup the string and subtract half(all) of the width from the x position */
X		fprintf(tfp,") dup stringwidth pop %s %d exch sub ",
X				(t->type == T_CENTER_JUSTIFIED? "2 div": ""),t->base_x);	
X		fprintf(tfp,"%d moveto ",t->base_y);
X		}
X	else
X		fprintf(tfp,") %d %d moveto ",t->base_x,t->base_y);
X
X	if (coord_system == 2) 	/* upper left is 0,0 */
X	    fprintf(tfp, "1 -1 scale show 1 -1 scale\n");
X	else
X	    fprintf(tfp, "show\n");
X	}
X
Xgenps_arc(a,fill)
XF_arc	*a;
Xint fill;
X{
X	double		angle1, angle2, dx, dy, radius, x, y;
X	double		cx, cy, sx, sy, ex, ey;
X	int		direction;
X
X	if ((fill && a->area_fill==0) ||
X	    (fill==0 && a->area_fill))
X		return;
X
X	cx = a->center.x; cy = a->center.y;
X	sx = a->point[0].x; sy = a->point[0].y;
X	ex = a->point[2].x; ey = a->point[2].y;
X
X	if (coord_system == 2)
X	    direction = !a->direction;
X	else
X	    direction = a->direction;
X	set_linewidth(a->thickness);
X	if (a->for_arrow && a->thickness > 0) {
X	    arc_tangent(cx, cy, ex, ey, direction, &x, &y);
X	    draw_arrow_head(x, y, ex, ey, a->for_arrow->ht, a->for_arrow->wid);
X	    }
X	if (a->back_arrow && a->thickness > 0) {
X	    arc_tangent(cx, cy, sx, sy, !direction, &x, &y);
X	    draw_arrow_head(x, y, sx, sy, a->back_arrow->ht, a->back_arrow->wid);
X	    }
X	dx = cx - sx;
X	dy = cy - sy;
X	radius = sqrt(dx*dx + dy*dy);
X	angle1 = atan2(sy-cy, sx-cx) * 180 / M_PI;
X	angle2 = atan2(ey-cy, ex-cx) * 180 / M_PI;
X	/* direction = 1 -> Counterclockwise */
X	set_style(a->style, a->style_val);
X	fprintf(tfp, "newpath %.3f %.3f %.3f %.3f %.3f %s\n",
X		cx, cy, radius, angle1, angle2,
X		((direction == 1) ? "arc" : "arcn"));
X	if (a->area_fill)
X		{
X		set_areafill(a->area_fill);
X		fprintf(tfp, " closepath gsave fill grestore\n");
X		set_areafill(NUMFILLPATS);	/* back to black for line */
X		}
X	if (a->thickness > 0)
X		fprintf(tfp," stroke\n");
X	reset_style(a->style, a->style_val);
X	}
X
Xarc_tangent(x1, y1, x2, y2, direction, x, y)
Xdouble	x1, y1, x2, y2, *x, *y;
Xint	direction;
X{
X	if (direction) { /* counter clockwise  */
X	    *x = x2 + (y2 - y1);
X	    *y = y2 - (x2 - x1);
X	    }
X	else {
X	    *x = x2 - (y2 - y1);
X	    *y = y2 + (x2 - x1);
X	    }
X	}
X
X/*	draw arrow heading from (x1, y1) to (x2, y2)	*/
X
Xdraw_arrow_head(x1, y1, x2, y2, arrowht, arrowwid)
Xfloat	x1, y1, x2, y2, arrowht, arrowwid;
X{
X	float	x, y, xb, yb, dx, dy, l, sina, cosa;
X	float	xc, yc, xd, yd;
X
X	dx = x2 - x1;  dy = y1 - y2;
X	l = sqrt((double)(dx*dx + dy*dy));	/* length of line */
X	sina = dy / l;  cosa = dx / l;
X	xb = x2*cosa - y2*sina;
X	yb = x2*sina + y2*cosa;
X	x = xb - arrowht;
X	y = yb - arrowwid / 2;
X	xc = x*cosa + y*sina;			/* one tail of arrow */
X	yc = -x*sina + y*cosa;
X	y = yb + arrowwid / 2;
X	xd = x*cosa + y*sina;			/* other tail of arrow */
X	yd = -x*sina + y*cosa;
X	fprintf(tfp, "newpath %.3f %.3f moveto %.3f %.3f lineto %.3f %.3f lineto stroke\n",
X		xc, yc, x2, y2, xd, yd);
X	}
X
Xellipse_exist(ob)
XF_compound	*ob;
X{
X	F_compound	*c;
X
X	if (NULL != ob->ellipses) return(1);
X
X	for (c = ob->compounds; c != NULL; c = c->next) {
X	    if (ellipse_exist(c)) return(1);
X	    }
X
X	return(0);
X	}
X
Xnormal_spline_exist(ob)
XF_compound	*ob;
X{
X	F_spline	*s;
X	F_compound	*c;
X
X	for (s = ob->splines; s != NULL; s = s->next) {
X	    if (normal_spline(s)) return(1);
X	    }
X
X	for (c = ob->compounds; c != NULL; c = c->next) {
X	    if (normal_spline_exist(c)) return(1);
X	    }
X
X	return(0);
X	}
X
X/*VARARGS1*/
Xput_msg(format, arg1, arg2, arg3, arg4, arg5)
X	char    *format;
X	int     arg1, arg2, arg3, arg4, arg5;
X{
X	fprintf(stderr, format, arg1, arg2, arg3, arg4, arg5);
X}
END_OF_FILE
if test 20408 -ne `wc -c <'f2ps.c'`; then
    echo shar: \"'f2ps.c'\" unpacked with wrong size!
fi
# end of 'f2ps.c'
fi
if test -f 'xfig.man' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'xfig.man'\"
else
echo shar: Extracting \"'xfig.man'\" \(21624 characters\)
sed "s/^X//" >'xfig.man' <<'END_OF_FILE'
X.TH XFIG 1 "Release 2.0 (Protocol 1.4X)"
X.SH NAME
Xxfig \- Facility for Interactive Generation of figures under X11
X.SH SYNOPSIS
X.B xfig
X[ \fB-ri[ght]\fP ] 
X[ \fB-le[ft]\fP ]
X[ \fB-L[andscape]\fP ]
X[ \fB-P[ortrait]\fP ]
X[ \fB-pw[idth]\fP \fIunits\fP ]
X[ \fB-ph[eight]\fP \fIunits\fP ]
X[ \fB-not[rack]\fP ]
X[ \fB-tr[ack]\fP ]
X[ \fB-inc[hes]\fP ]
X[ \fB-me[tric]\fP ]
X[ \fB-inv[erse]\fP ]
X[ \fB-de[bug]\fP ]
X[ \fIfile\fP ]
X[ \fB-normal[Font]\fP \fIfont\fP ]
X[ \fB-bold[Font]\fP \fIfont\fP ]
X.SH DESCRIPTION
X.I Xfig 
Xis a menu-driven tool that allows the user to draw and manipulate objects
Xinteractively in an X window.  
X.B It runs under X version 11 release 4 only
Xand requires a three-button mouse.
X.I File 
Xspecifies the name of a file to be edited. The description of objects in
Xthe file will be read at the start of \fIxfig\fP. 
X.PP
XThe output from \fIxfig\fP can be printed in several ways:
X.PP
X.B Postscript -
Xf2ps (\fIxfig\fP to \fIpostscript\fP translator) is used to produce
X\fIpostscript\fP from an \fIxfig\fP file.
XThis can be sent directly to a postscript printer or a file.
X.PP
X.B Troff -
Xf2p (\fIxfig\fP to \fIpic\fP(1) translator, also known by its previous
Xname \fIf2fp\fP(1L)) is used to translate \fIxfig\fP files into
X.IR pic (1)
Xlanguage.
XThe resulting output may then be processed in the same manner as any other
X.I pic
Xfile.  Note that area fill is not supported by \fIf2p\fP.
X.PP
X.B Note: 
XThe \fIf2p\fP and \fIf2ps\fP translators will be eventually phased out
Xbecause the \fITransFig\fP package from Micah Beck is a more general
Xpurpose translator for more graphics languages.
XThe \fITransFig\fP package can be used as a back-end processor to xfig 
Xto produce various types of output:
X.IP "LaTeX - "12 
X\fIfig2dev -L latex\fP translates \fIxfig\fP to \fILaTeX\fP
Xpicture environment commands which can be
Xprocessed along with other
X.I LaTeX
Xcommands.
X.IP "Postscript -
X\fIfig2dev -L ps\fP produces a postscript output.
X.IP "Pic -
X\fIfig2dev -L pic\fP produces a pic output.
X.IP "PiCTeX -
X\fIfig2dev -L pictex\fP produces
X.I PiCTeX
Xoutput.
XThis contains macros that can be used with the
X.I PiCTeX
Xenvironment under
X.I TeX
Xor
X.I LaTeX.
X.IP "Others -
Xfig2dev has options for these other languages:
X\fIbox\fP,
X\fIepic\fP,
X\fIeepic\fP,
Xand \fIeepicemu\fP.
X.PP
XThe \fITransFig\fP package is available from
Xsvax.cs.cornell.edu (directory /pub/fig) and from 
Xsun.soe.clarkson.edu (directory /pub/transfig) via anonymous ftp.
XIt is also available by mail from the Clarkson archive server.
XTo find out about using the server, send the one-line message "help" to
Xarchive-server at sun.soe.clarkson.edu.
X.SH OPTIONS
X.TP
X.B \-ri
XChange the position of the side panel window to the right of the canvas window
X(default: left).
X.TP
X.B \-le
XChange the position of the side panel window to the left of the canvas window.
X.TP
X.B \-L
XMake \fIxfig\fP come up in landscape mode (10" x 7.5").  This is the default.
X.TP
X.B \-P
XMake \fIxfig\fP come up in portrait mode (7.5" x 10").
X.TP
X\fB-pw\fP \fIunits\fP
XMake \fIxfig\fP come up \fIunits\fP wide (where units are either cm or in).
X.TP
X\fB-ph\fP \fIunits\fP
XMake \fIxfig\fP come up \fIunits\fP high (where units are either cm or in).
X.TP
X\fB-tr\fP
XTurn on cursor (mouse) tracking arrows.
X.TP
X\fB-no\fP
XTurn off cursor (mouse) tracking arrows.
X.TP
X\fB-inc\fP
XMake inches the unit of choice (default).
X.TP
X\fB-me\fP
XMake centimeters the unit of choice.
X.TP
X\fB-inv\fP
XUse inverse video (white on black).
X.TP
X\fB-de\fP
XTurn on debugging mode.
X.TP
X\fB-normal\fP \fIfont\fP
XCause the font used for questions to be \fIfont\fP.
XThis font is also used on the canvas when the selected font is not available
Xin an X11 font.
X.TP
X\fB-bold\fP \fIfont\fP
XCause the font used for displaying messages to be \fIfont\fP.
X.SH "GRAPHICAL OBJECTS"
XThe objects in \fIxfig\fP are divided into \fBprimitive objects\fP and
X\fBcompound object\fP. The primitive objects are: \fIARC\fP, \fICIRCLE\fP,
X\fICLOSED SPLINE\fP, \fIELLIPSE\fP, \fIPOLYLINE\fP, \fIPOLYGON\fP,
X\fISPLINE\fP, and \fITEXT\fP.  A primitive can be moved, rotated,
Xflipped, copied or erased.
XThe TEXT primitive cannot be rotated or flipped.
XA compound object is composed of primitive objects. The primitive objects
Xthat constitute a compound can not be individually modified, but they can
Xbe manipulated as an entity; a compound can be moved, rotated, flipped,
Xcopied or erased.  An extra function that can be applied to a compound
Xobject is \fBscaling\fP, which is not available for primitive objects.
X.SH "DISPLAY WINDOWS"
XNine windows comprise the display area of \fIxfig\fP: the 
Xtop ruler, the side ruler, two panel windows, the message window,
Xthree indicator windows showing current line thickness, area-fill gray
Xcolor and rounded box corner radius, and the canvas window. 
XThe main panel window can be placed to the left or right of the
Xthe canvas window (default: left), and the second panel window 
Xis always below the message window.  It contains buttons for quick
Xaccess to some of the pop-up menu commands.
X.SH "POP-UP MENU"
XThe pop-up menu appears when the right mouse button is pressed with the
Xcursor positioned within the canvas window.
XPositioning the cursor over the desired menu entry and releasing the
Xbutton selects a menu entry.
X.PP
XThere are a number of file accessing functions in the pop-up menu.
XMost of the time when one of these functions is selected, the user
Xwill be asked for a file name.  If the specified file can be located
Xand the access permission are granted, \fIxfig\fP will carry out
Xthe function.  However in case things go wrong, \fIxfig\fP will
Xabort the function and printed the causes on the message window.
XMost of the functions in the pop-up menu can be directly access with
Xthe lower button panel.
X.TP
X.I Undo
XUndo the last object creation or modification.
X.TP
X.I Redisplay
XRedraw the canvas.
X.TP
X.I Remove all
XRemove all objects on the canvas window (can be undone).
X.TP
X.I Edit file ...
XThe current contents of the canvas are cleared and the figure
Xis read from the specified file.
XThe user will be asked for a file name.
XThis file will become the current file.
X.TP
X.I Save
XSave the current contents of the canvas in the current file.
XIf no file is being edited, the user will be asked for a file
Xname as in the "Save in ..." function.
X.TP
X.I Read file ...
XRead figure from the specified file and merge it with the figure already
Xshown on the canvas.
X(The user will be asked for a file name.)
X.TP
X.I Save in ...
XSave the figure on the screen into a file specified by the user.
X(The user will be asked for a file name.)
XIf there is no current file name, it will be set to the name specified
Xin the save.
X.TP
X.I Status
XShow the name of the current file and directory.
X.TP
X.I Change Directory
XChange the working directory.  Any file name without a full path name
Xwill employ the current working directory.
X.TP
X.I Save & Quit
XSave the figure in the current file and exit from \fIxfig\fP.
XIf there is no current file, the user will be asked for a file name.
XNo confirmation will be asked.
X.TP
X.I Save as Bitmap
XCreate an X11 bitmap from the figure the size of which is determined
Xby the enclosing rectangle of all the figure plus a small border.
X.TP
X.I Quit
XExit from \fIxfig\fP, discarding the figure. The user will be asked to 
Xconfirm the action, by clicking the left button.
X.SH "BOTTOM PANEL COMMAND FUNCTIONS"
XMost of the buttons in the bottom panel are counterparts to the pop-up menu functions.
XHowever, there are additional buttons for selecting font, font size, print orientation
X(landscape or portrait) and the printer device itself.
X.SH "BOTTOM PANEL WINDOW COMMAND DESCRIPTIONS"
X.TP
X.I FONT SELECT
XThis button pops up a menu of 35 fonts available for most Apple 
XPostscript printers.
XThe name of the font is printed in the font itself so that one may see 
Xwhat that font looks like.
XIf a corresponding X11 font exists, new text is created 
Xon the canvas using that font.
X\fIxfig\fP uses the size of X11 font closest to that selected 
Xby the font size button.
XIf the X11 font doesn't exist, \fIxfig\fP uses the font 
Xselected by the "-normal" option.
XTo abort selection of a font, click on the title of the menu.
X.TP
X.I FONT SIZE
XThe left button decreases the point size of font used on the canvas and printer.
XThe right button increases the point size.
X.TP
X.I LANDSCAPE/PORTRAIT
XSelect landscape or portrait mode of printing.
XThe default setting is that of the \fIxfig\fP canvas.
X.TP
X.I PRINTER SELECT
XToggle through a list of printers available for printing the figure. 
XAt present this list must be compiled into \fIxfig\fP.
X.TP
X.I TEXT JUSTIFICATION
XClicking this button cycles through selection of left, center and right justification
Xof text.
X.SH "SIDE PANEL WINDOW MANIPULATION FUNCTIONS"
XIcons in the side panel window represent object manipulation functions,
Xmodes and other drawing or modification aids.
XManipulation functions are selected by positioning the cursor over it and
Xclicking the left mouse button.  The selected icon is highlighted, and
Xa message describing its function appears in the message window.
X.PP
XThe left and middle buttons are used to create and modify objects in the canvas
Xwindow.  Most actions start with clicking of the left button
Xand end with clicking of the middle button.
XThere is no need to hold down a button while positioning
Xthe cursor.
X.SH "SIDE PANEL WINDOW COMMAND DESCRIPTIONS"
XEntries in the side panel window can be classified into two categories:
Xobject creation/modification/removal commands (only one of which may be active
Xat any one time), and drawing aids (which act as toggle switches or settings).
XThere are two ways for drawing circles, two for ellipses, two for splines
Xand two for closed splines.
XThere are two basic splines.  One is the interpolated spline
Xin which the spline pass thorough the entered points (knots).
XThe other is the normal spline in which on control points are
Xpassed by the spline (except for the two end points in the open spline).
X.SH "OBJECT CREATION/MODIFICATION/REMOVAL"
XMultiple commands are grouped thematically in the following
Xdescriptions (which is listed alphabetically).
X.TP
X.I AREA-FILL ON/OFF
XTurn on or off area-fill mode.  This will affect any arcs, boxes, 
Xpolygons, circles, closed splines or ellipses created subsequently.
X.TP
X.I ADD/DELETE ARROWS
XAdd or delete arrow heads for \fIPOLYLINE\fP, \fIPOLYGON\fP, \fISPLINE\fP
Xor \fICLOSED SPLINE\fP objects (points of a \fIBOX\fP can not be added or
Xdeleted).
X.TP
X.I ADD/DELETE POINTS
XAdd or delete points for \fIPOLYLINE\fP, \fIPOLYGON\fP, \fISPLINE\fP
Xor \fICLOSED SPLINE\fP objects (points of a \fIBOX\fP can not be added
Xor deleted).
X.TP
X.I ARC
XCreate an arc.  Specify three points using the left button.
X.TP
X.I BOX
XCreate rectangular boxes.  Start with the left button and terminate with
Xthe middle button.
X.TP
X.I ROUNDED-CORNER BOX
XCreate rectangular boxes with rounded corners.  Start with the
Xleft button and terminate with the middle button.  
XThe radius of the corners is selected by the INCREASE/DECREASE RADIUS button.
X.TP
X.I BREAK COMPOUND
XBreak a compound object to allow manipulation of its component parts.
XClick the left button on the bounding box of
Xthe compound object.
X.TP
X.I CHANGE OBJECT
XChange settings for an existing object.
XClick the left button on the object and a pop-up menu will appear
Xshowing existing settings for the object.  Some of the menu entries
Xmay be changed by typing new values in the appropriate windows. These
Xallow cut and paste.
XOthers pop up a sub-menu of multiple choices when pressed and held.
XPress the "done" button to apply the changes to the object and finish.
XPress the "apply" button to apply the changes but keep the menu up for
Xfurther changes.  Press the "cancel" button to cancel the changes and 
Xpop down the menu.
X.TP
X.I CIRCLE 
XCreate circles by specifying their radii or diameters.
XClick the left button on the canvas window, move the cursor until the
Xdesired radius or diameter is reached, then click the middle button to
Xterminate. The circle will be drawn after the pressing of the middle button.
X.TP
X.I CLOSED INTERPOLATED SPLINE
XCreate closed or periodic splines.  The function is similar
Xto \fIPOLYGON\fP except that a closed interpolated spline is drawn.
XThe spline will pass through the points (knots).
X.TP
X.I CLOSED SPLINE
XCreate closed or periodic spline objects.
XThe function is similar to \fIPOLYGON\fP
Xexcept that a closed spline will be drawn instead of polygon.
XThe entered points are just control points; i.e., the spline will
Xnot pass any of these points.
X.TP
X.I COPY
XCopy object.  Click the left button over part of the object to be
Xcopied (for \fICIRCLE\fP and \fIELLIPSE\fP
Xobjects, position on their circumferences).  Drag the object to the desired
Xposition and click the middle button.
XThis function as well as the following three functions 
X(\fIMOVE\fP, \fIMOVE POINT\fP, \fIREMOVE\fP)
Xwill cause point markers (manipulation aids) to be shown on the canvas window.
XThere are no markers for \fICIRCLE\fP or \fIELLIPSE\fP objects.
X.TP
X.I DARKEN/LIGHTEN AREA-FILL COLOR
XThe left button lightens the area-fill color 
X(black to white through 20 gray levels).  The right button darkens it.
XThe (approximate) current area fill color is shown in the right-most
Xindicator window.
X.TP
X.I ELLIPSE
XCreate ellipses using the same procedure as for the drawing of circles.
X.TP
X.I FLIP
XInvert the object (middle button) or produce a mirror-image copy of an
Xobject (left button). Point to part of the object ("the handle"), click
Xthe appropriate button.
X.TP
X.I GLUE
XGlue the objects within a bounding box into a compound object
X(the bounding box itself is not part of the figure; 
Xit is a visual aid for manipulating the compound). 
X.TP
X.I INCREASE/DECREASE LINE THICKNESS
XThe left button decreases the line thickness by one pixel, the right
Xbutton increases it by one pixel.  The current line thickness
Xis shown in the left-most indicator window.
X.TP
X.I INCREASE/DECREASE RADIUS OF ROUNDED BOX CORNERS
XThe left button decreases the radius used in the corners of rounded boxes, 
Xthe right button increases it. The current radius is shown in the middle
Xindicator window.
X.TP
X.I INTERPOLATED SPLINE
XCreate (cubic spline) spline objects.
XEnter control vectors in the same way as for creation of a
X\fIPOLYLINE\fP object.
XAt least three points (two control vectors) must be entered.
XThe spline will pass through the entered points.
X.TP
X.I MOVE
XMove objects in the same way as in \fICOPY\fP.
X.TP
X.I MOVE POINT
XModify the position of points of \fIPOLYLINE\fP, \fIBOX\fP, \fIPOLYGON\fP,
X\fIELLIPSE\fP, \fIARC\fP and \fISPLINE\fP
Xobjects.  Click the left button over the desired point, reposition the point,
Xand click the middle button.  Note that \fIBOX\fP, 
X\fIROUNDED-CORNER BOX\fP and \fIPOLYGON\fP 
Xobjects are internally stored as \fIPOLYLINE\fP
Xobjects, and therefore moving certain points may open these objects.
X.TP
X.I POLYGON
XSame as \fIPOLYLINE\fP
Xexcept that a line segment is drawn connecting the first and last
Xpoints entered.
X.TP
X.I POLYLINE
XCreate polylines (line segments connecting a sequence of points).
XEnter points by clicking the left button at the desired positions on the
Xcanvas window.  Click the middle button to terminate.
X.TP
X.I REMOVE
XRemove (or delete) objects.
X.TP
X.I ROTATE
XRotate the object (middle button) or copy (left button) +90 degrees.
X.TP
X.I SCALE COMPOUND
XOnly compound objects can be scaled.  Click the left button
Xon a corner of the bounding box, stretch the
Xbounding box to the desired size, and click the middle button.
XOr click the left button on a side of the bounding box, stretch that
Xside to the desired size, and click the middle button.
X.TP
X.I SPLINE
XCreate (quadratic spline) spline objects.
XEnter control vectors in the same way as for creation of a
X\fIPOLYLINE\fP object.
XAt least three points (two control vectors) must be entered.
XThe spline will pass only the two end points.
X.TP
X.I TEXT
XCreate text strings. Click the left button at the desired position on
Xthe canvas window, then enter text from the keyboard.
XText is drawn using the current font, font size and justification settings.
XA DEL or ^H (backspace) will delete a character, while a ^U will kill
Xthe entire line.
XTerminate by clicking the middle button or typing the return key.  To
Xedit text, click on an existing text string with the left button.
XInsertion of characters will take place at that point.  
X.TP
X.I TURN
XTurn \fIPOLYGON\fP into a \fICLOSED INTERPOLATED SPLINE\fP object, or
Xturn \fIPOLYLINE\fP into a \fIINTERPOLATED SPLINE\fP object.
X.SH "DRAWING AIDS"
XDrawing aids act as toggle switches. More than one can be selected at a time
X(except for \fIGRID\fP and the line drawing modes).
X.TP
X.I AUTO FORWARD/BACKWARD ARROW
XAutomatically add forward/backward arrow heads to \fIPOLYLINE\fP, \fISPLINE\fP
Xor \fIARC\fP objects.
X.TP
X.I MAGNET
XRound points to the nearest 1/16 of an inch.
XThis affects every function, and is provided as an alignment aid.
X.TP
X.I UNRESTRICTED
XAllow lines to be drawn with any slope.
X.TP
X.I LATEX LINE
XAllow lines to be drawn only at slopes which can be handled by LaTeX picture
Xenvironment lines: slope = x/y, where x,y are integers in the range [-6,6].
X.TP
X.I LATEX VECTOR
XAllow lines to be drawn only at slopes which can be handled by LaTeX picture
Xenvironment vectors: slope = x/y, where x,y are integers in the range [-4,4].
X.TP
X.I MANHATTAN
XEnforce drawing of lines in the horizontal and vertical direction only.
XBoth \fIMANHATTAN\fP and \fIMOUNTAIN\fP can be turned on simultaneously. The
Xcreations of \fIPOLYGON\fP, \fIPOLYLINE\fP and \fISPLINE\fP objects are
Xaffected by these two modes.
X.TP
X.I MOUNTAIN
XEnforce drawing of only diagonal lines.  Both \fIMANHATTAN\fP
Xand \fIMOUNTAIN\fP can be turned on simultaneously. The creations
Xof \fIPOLYGON\fP, \fIPOLYLINE\fP and \fISPLINE\fP objects are affected
Xby these two modes.
X.TP
X.I MANHATTAN MOUNTAIN
XAllow lines to be drawn at any slope allowed when in
XMOUNTAIN or MANHATTAN modes.
X.TP
X.I GRID
XDisplay either the quarter- or half-inch grids (left button).
X.TP
X.I SOLID/DASHED/DOTTED LINE STYLE
XToggle between solid, dashed and dotted line styles. The dash length
Xis fixed at 0.05 inch.
X.SH X DEFAULTS
XThe overall widget name(Class) is xfig.fig(Fig.TopLevelShell).  This
Xset of resources correspond to the command line arguments:
X.TP 1.25i
Xjustify
X(boolean:false) -right (true) and -left (false) arguments
X.TP
Xlandscape
X(boolean:true) -Landscape and -Portrait arguments
X.TP
Xpwidth
X(integer:7.5 or 10 inches) -pwidth argument
X.TP
Xpheight
X(integer:10 or 7.5 inches) -pheight argument
X.TP
XtrackCursor
X(boolean:on) -track and -notrack arguments
X.TP
Xinches
X(boolean:true) -inches and -metric arguments
X.TP
XreverseVideo
X(boolean:off) -inverse argument
X.TP
Xdebug
X(boolean:off) -debug argument
X.TP
XnormalFont
X(string:fixed) -normal argument
X.TP
XboldFont
X(string:8x13bold) -bold argument
X.PP
XThese arguments correspond to the widgets which make up \fIxfig\fP.
X.TP 1.5i
Xoverall window
Xform(Form)
X.TP
Xside panel
Xform.side_panel(Form.Box)
X.TP
Xbottom panel
Xform.bottom_panel(Form.Box)
X.TP
Xbuttons
Xform.side_panel.button(Form.Box.Command)
Xform.bottom_panel.button(Form.Box.Command)
X.TP
Xtop ruler
Xform.truler(Form.Label)
X.TP
Xside ruler
Xform.sruler(Form.Label)
X.TP
Xcanvas
Xform.canvas(Form.Label)
X.TP
Xmessage window
Xform.message(Form.Command)
X.TP
Xcommand menu
Xform.popup_menu.menu(Form.OverrideShell.Box)
X.TP
Xcommand menu title
Xform.popup_menu.menu.title(Form.OverrideShell.Box.Label)
X.TP
Xcommand menu items
Xform.popup_menu.menu.pane(Form.OverrideShell.Box.Command)
X.TP
Xfont menu
Xform.font_menu.menu(Form.OverrideShell.Box)
X.TP
Xchange menu
Xchange.form(TransientShell.Form)
X.TP
Xindicator panel
Xform.indicator(Form.Box)
X.TP
Xfont indicator window
Xform.font_indicator(Form.Label)
X.PP
XFor example, to set the background of the side panel to blue and the 
Xindicator panel background to green the resources
Xwould be:
X.br
X\f(CWxfig*form.panel.background: blue\fP
X.br
X\f(CWxfig*form.indicator.background: blue\fP
X.SH BUGS
X.PP
XCreating a text object is not "Undoable".
X.PP
XArea fill doesn't show on the canvas for closed splines, but are filled 
Xwhen printed.  This has to do with the way the splines are generated on the
Xscreen.
X.PP
XUndoing the creation of a compound object deletes the objects
Xoutside the compound object.  Undoing the undo doesn't bring them back.
X.PP
XEllipses which are too narrow are not drawn correctly.
X.SH "SEE ALSO"
XBrian W. Kernighan
X.I "PIC - A Graphics Language for Typesetting User Manual"
X.br
Xf2ps(1) f2p(1)
X.SH ACKNOWLEDGEMENT
XMany thanks goes to Professor Donald E. Fussell who inspired the
Xcreation of this tool.
X.SH AUTHORS
XOriginal author:
X.br
XSupoj Sutanthavibul
X.br
XUniversity of Texas at Austin 
X.br
X(supoj at sally.utexas.edu) 
X.sp
XManual page modified by:
X.br
XR. P. C. Rodgers
X.br
XUCSF School of Pharmacy
X.br
XSan Francisco, CA 94118 
X.sp
XThe LaTeX line drawing modes were contributed by:
X.br
XFrank Schmuck
X.br
XCornell University
X.sp
XX11 port by:
X.br
XKen Yap
X.br
XRochester
X.br
X(ken at cs.rochester.edu)
X.sp
XVariable window sizes, cleanup of X11 port, right hand side panel
Xunder X11, X11 manual page provided by:
X.br
XDana Chee
X.br
XBellcore
X.br
X(dana at bellcore.com)
X.sp
XCleanup of color port to X11 by:
X.br
XJohn T. Kohl
X.br
XMIT
X.br
X(jtkohl at athena.mit.edu)
X.sp
XArea fill, multiple line thicknesses, multiple fonts and font sizes,
Xbottom panel, line style/thickness modification of objects by:
X.sp
XBrian V. Smith
X.br
XLawrence Berkeley Laboratory
X.br
X(standard disclaimer applies)
X.br
X(bvsmith at lbl.gov)
X.sp
XPopup change-object menu by:
X.br
XJon Tombs
X(jon%robots.oxford.ac.uk at nsfnet-relay.ac.uk)
X.br
Xand
X.br
XFrank Schmuck 
X.br
X(schmuck at svax.cs.cornell.edu)
END_OF_FILE
if test 21624 -ne `wc -c <'xfig.man'`; then
    echo shar: \"'xfig.man'\" unpacked with wrong size!
fi
# end of 'xfig.man'
fi
echo shar: End of archive 14 \(of 21\).
cp /dev/null ark14isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 21 archives.
    rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

dan
----------------------------------------------------
O'Reilly && Associates   argv at sun.com / argv at ora.com
Opinions expressed reflect those of the author only.



More information about the Comp.sources.x mailing list