xref: /titanic_41/usr/src/cmd/eqn/font.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
2*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
3*7c478bd9Sstevel@tonic-gate 
4*7c478bd9Sstevel@tonic-gate 
5*7c478bd9Sstevel@tonic-gate /*
6*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
7*7c478bd9Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
8*7c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
9*7c478bd9Sstevel@tonic-gate  */
10*7c478bd9Sstevel@tonic-gate 
11*7c478bd9Sstevel@tonic-gate /*
12*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1983, 1984 1985, 1986, 1987, 1988, Sun Microsystems, Inc.
13*7c478bd9Sstevel@tonic-gate  * All Rights Reserved.
14*7c478bd9Sstevel@tonic-gate  */
15*7c478bd9Sstevel@tonic-gate 
16*7c478bd9Sstevel@tonic-gate #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.1	*/
17*7c478bd9Sstevel@tonic-gate 
18*7c478bd9Sstevel@tonic-gate # include "e.h"
19*7c478bd9Sstevel@tonic-gate 
20*7c478bd9Sstevel@tonic-gate setfont(ch1) char ch1; {
21*7c478bd9Sstevel@tonic-gate 	/* use number '1', '2', '3' for roman, italic, bold */
22*7c478bd9Sstevel@tonic-gate 	yyval = ft;
23*7c478bd9Sstevel@tonic-gate 	if (ch1 == 'r' || ch1 == 'R')
24*7c478bd9Sstevel@tonic-gate 		ft = ROM;
25*7c478bd9Sstevel@tonic-gate 	else if (ch1 == 'i' || ch1 == 'I')
26*7c478bd9Sstevel@tonic-gate 		ft = ITAL;
27*7c478bd9Sstevel@tonic-gate 	else if (ch1 == 'b' || ch1 == 'B')
28*7c478bd9Sstevel@tonic-gate 		ft = BLD;
29*7c478bd9Sstevel@tonic-gate 	else
30*7c478bd9Sstevel@tonic-gate 		ft = ch1;
31*7c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", ft);
32*7c478bd9Sstevel@tonic-gate #ifndef NEQN
33*7c478bd9Sstevel@tonic-gate 	if(dbg)printf(".\tsetfont %c %c\n", ch1, ft);
34*7c478bd9Sstevel@tonic-gate #else NEQN
35*7c478bd9Sstevel@tonic-gate 	if(dbg)printf(".\tsetfont %c\n", ft);
36*7c478bd9Sstevel@tonic-gate #endif NEQN
37*7c478bd9Sstevel@tonic-gate }
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate font(p1, p2) int p1, p2; {
40*7c478bd9Sstevel@tonic-gate 		/* old font in p1, new in ft */
41*7c478bd9Sstevel@tonic-gate 	yyval = p2;
42*7c478bd9Sstevel@tonic-gate 	lfont[yyval] = rfont[yyval] = ft==ITAL ? ITAL : ROM;
43*7c478bd9Sstevel@tonic-gate 	if(dbg)printf(".\tb:fb: S%d <- \\f%c S%d \\f%c b=%d,h=%d,lf=%c,rf=%c\n",
44*7c478bd9Sstevel@tonic-gate 		yyval, ft, p2, p1, ebase[yyval], eht[yyval], lfont[yyval], rfont[yyval]);
45*7c478bd9Sstevel@tonic-gate 	printf(".ds %d \\f%c\\*(%d\\f%c\n",
46*7c478bd9Sstevel@tonic-gate 		yyval, ft, p2, p1);
47*7c478bd9Sstevel@tonic-gate 	ft = p1;
48*7c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", ft);
49*7c478bd9Sstevel@tonic-gate }
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate fatbox(p) int p; {
52*7c478bd9Sstevel@tonic-gate 	int sh;
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate 	yyval = p;
55*7c478bd9Sstevel@tonic-gate 	sh = ps / 4;
56*7c478bd9Sstevel@tonic-gate 	nrwid(p, ps, p);
57*7c478bd9Sstevel@tonic-gate 	printf(".ds %d \\*(%d\\h'-\\n(%du+0.05m'\\*(%d\n", p, p, p, p);
58*7c478bd9Sstevel@tonic-gate 	if(dbg)printf(".\tfat %d, sh=0.05m\n", p);
59*7c478bd9Sstevel@tonic-gate }
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate globfont() {
62*7c478bd9Sstevel@tonic-gate 	char temp[20];
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate 	getstr(temp, 20);
65*7c478bd9Sstevel@tonic-gate 	yyval = eqnreg = 0;
66*7c478bd9Sstevel@tonic-gate 	gfont = temp[0];
67*7c478bd9Sstevel@tonic-gate 	switch (gfont) {
68*7c478bd9Sstevel@tonic-gate 	case 'r': case 'R':
69*7c478bd9Sstevel@tonic-gate 		gfont = '1';
70*7c478bd9Sstevel@tonic-gate 		break;
71*7c478bd9Sstevel@tonic-gate 	case 'i': case 'I':
72*7c478bd9Sstevel@tonic-gate 		gfont = '2';
73*7c478bd9Sstevel@tonic-gate 		break;
74*7c478bd9Sstevel@tonic-gate 	case 'b': case 'B':
75*7c478bd9Sstevel@tonic-gate 		gfont = '3';
76*7c478bd9Sstevel@tonic-gate 		break;
77*7c478bd9Sstevel@tonic-gate 	}
78*7c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", gfont);
79*7c478bd9Sstevel@tonic-gate 	ft = gfont;
80*7c478bd9Sstevel@tonic-gate }
81