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