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