xref: /csrg-svn/old/vpr/vtools/fed/fed.h (revision 11506)
1*11506Sralph /*	fed.h	4.1	83/03/09	*/
2*11506Sralph /*
3*11506Sralph  * fed.h: global definitions for font editor.
4*11506Sralph  */
5*11506Sralph 
6*11506Sralph #include <stdio.h>
7*11506Sralph #include <ctype.h>
8*11506Sralph #include <vfont.h>
9*11506Sralph #include <signal.h>
10*11506Sralph #include <setjmp.h>
11*11506Sralph 
12*11506Sralph /* current windows - what's on the screen */
13*11506Sralph 
14*11506Sralph #define SCRHI	360		/* number of pixels on the screen */
15*11506Sralph #define SCRWID	720		/* width in pixels of the screen */
16*11506Sralph #define NROW	3		/* number of rows of glyphs on the screen */
17*11506Sralph #define NCOL	7		/* number of cols of glyphs in a row */
18*11506Sralph #define NWIND	(NROW*NCOL)	/* number of windows */
19*11506Sralph #define GLCOL	100		/* width of a glyph window */
20*11506Sralph #define GLROW	100		/* height of a glyph window */
21*11506Sralph #define GLPAD	3		/* number of pixels between windows */
22*11506Sralph #define WINDSIZE (((GLCOL+7)>>3)*GLROW)	/* size in bytes of a window */
23*11506Sralph #define BASELINE 22		/* number of pixels below baseline in window */
24*11506Sralph #define SLOPE	(3.5)		/* Amount to slant italic vertical line */
25*11506Sralph 				/* equal to about 15.94 degrees */
26*11506Sralph 				/* for 5 degree caligraphy slant use 11.43 */
27*11506Sralph 
28*11506Sralph #define ESC	'\033'	/* The ASCII escape character */
29*11506Sralph 
30*11506Sralph #define abs(x)		((x) <  0  ? (-(x)) : (x))
31*11506Sralph #define max(x,y)	((x) > (y) ?   (x)  : (y))
32*11506Sralph #define min(x,y)	((x) < (y) ?   (x)  : (y))
33*11506Sralph 
34*11506Sralph typedef char *bitmat;
35*11506Sralph 
36*11506Sralph int	changes;	/* nonzero if changes since last write */
37*11506Sralph char	curchar;	/* current character being edited */
38*11506Sralph int	curcurs;	/* 1 if cursor is on now */
39*11506Sralph int	currb;		/* 1 if rubber band lie is on now */
40*11506Sralph int	curs_r, curs_c;	/* position in current window of graphics cursor */
41*11506Sralph int	curwind;	/* current open window number */
42*11506Sralph int	curzoom;	/* 1 to 9 - current zoom level of screen */
43*11506Sralph int	editing;	/* in file I/O command, true if editing font */
44*11506Sralph jmp_buf	env;
45*11506Sralph long	fbase;		/* first loc in font file of bits */
46*11506Sralph FILE *	fontdes;	/* open for reading, current font */
47*11506Sralph char	fontfile[100];	/* name of the font file */
48*11506Sralph int	hpensize;	/* size of heavy pen in pixels diameter of dot */
49*11506Sralph char	msgbuf[100];	/* scratch space to sprintf into for messages */
50*11506Sralph int	nextwind;	/* the next free window to grab */
51*11506Sralph int	oldzoom;	/* the value of curzoom before a message */
52*11506Sralph int	pen_r, pen_c;	/* row/col in current glyph of logical pen */
53*11506Sralph int	pencolor;	/* 0=erase, 1=draw */
54*11506Sralph int	penweight;	/* 0=fine, 1=heavy */
55*11506Sralph int	pointsize;	/* point size of current font */
56*11506Sralph int	QUIET;		/* true if -q flag */
57*11506Sralph char	stoutbuf[BUFSIZ];	/* for speed */
58*11506Sralph FILE	*trace;		/* for debugging output */
59*11506Sralph char	tracebuf[BUFSIZ];	/* for speed */
60*11506Sralph int	und_p_r, und_p_c;	/* pen_r, pen_c for undo */
61*11506Sralph int	und_c_r, und_c_c;	/* curs_r, curs_c for undo */
62*11506Sralph 
63*11506Sralph struct	header		FontHeader;
64*11506Sralph struct	dispatch	disptable[256];
65*11506Sralph 
66*11506Sralph struct	cwind	{
67*11506Sralph 	bitmat	val;		/* what we are making it into */
68*11506Sralph 	bitmat	onscreen;	/* what's currently on the screen */
69*11506Sralph 	bitmat	undval;		/* the previous version */
70*11506Sralph 	char	used;		/* the character using this window */
71*11506Sralph } wind[NROW * NCOL];
72*11506Sralph 
73*11506Sralph struct cht {
74*11506Sralph 	int	wherewind;	/* >=0: window # on screen, -1: in file, -2: use whereat */
75*11506Sralph 	bitmat	whereat;	/* where it can be found */
76*11506Sralph 	int	nrow, ncol;	/* size of char */
77*11506Sralph 	int	rcent, ccent;	/* bit location of lower left corner of main part of char */
78*11506Sralph } cht[256];
79*11506Sralph 
80*11506Sralph struct place {
81*11506Sralph 	int	c, r;
82*11506Sralph } base[NROW * NCOL];		/* lower left corner of each window */
83*11506Sralph 
84*11506Sralph char	penmat[10][10];		/* 0 or 1 as the pen is.  5,5 is center */
85*11506Sralph float	sqrtmat[10][10];	/* table of sqrt(i**2+j**2) for speed */
86*11506Sralph 
87*11506Sralph char	*rdchar();
88*11506Sralph char	esccmd();
89*11506Sralph bitmat	newmat();
90*11506Sralph bitmat	findbits();
91*11506Sralph int	onsig();
92*11506Sralph int	onintr();
93*11506Sralph float	sqrt();
94*11506Sralph 
95*11506Sralph int	matcnt[10];
96