xref: /onnv-gate/usr/src/cmd/eqn/font.c (revision 364:f36290b8cb0b)
1*364Sceastha /*
2*364Sceastha  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*364Sceastha  * Use is subject to license terms.
4*364Sceastha  */
5*364Sceastha 
60Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
70Sstevel@tonic-gate /*	  All Rights Reserved  	*/
80Sstevel@tonic-gate 
90Sstevel@tonic-gate /*
100Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
110Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
120Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
130Sstevel@tonic-gate  */
14*364Sceastha 
15*364Sceastha #pragma ident	"%Z%%M%	%I%	%E% SMI"
160Sstevel@tonic-gate 
17*364Sceastha #include "e.h"
180Sstevel@tonic-gate 
19*364Sceastha void
setfont(char ch1)20*364Sceastha setfont(char ch1)
21*364Sceastha {
220Sstevel@tonic-gate 	/* use number '1', '2', '3' for roman, italic, bold */
230Sstevel@tonic-gate 	yyval = ft;
240Sstevel@tonic-gate 	if (ch1 == 'r' || ch1 == 'R')
250Sstevel@tonic-gate 		ft = ROM;
260Sstevel@tonic-gate 	else if (ch1 == 'i' || ch1 == 'I')
270Sstevel@tonic-gate 		ft = ITAL;
280Sstevel@tonic-gate 	else if (ch1 == 'b' || ch1 == 'B')
290Sstevel@tonic-gate 		ft = BLD;
300Sstevel@tonic-gate 	else
310Sstevel@tonic-gate 		ft = ch1;
320Sstevel@tonic-gate 	printf(".ft %c\n", ft);
330Sstevel@tonic-gate #ifndef NEQN
34*364Sceastha 	if (dbg) printf(".\tsetfont %c %c\n", ch1, ft);
35*364Sceastha #else	/* NEQN */
36*364Sceastha 	if (dbg) printf(".\tsetfont %c\n", ft);
37*364Sceastha #endif	/* NEQN */
380Sstevel@tonic-gate }
390Sstevel@tonic-gate 
40*364Sceastha void
font(int p1,int p2)41*364Sceastha font(int p1, int p2)
42*364Sceastha {
430Sstevel@tonic-gate 		/* old font in p1, new in ft */
440Sstevel@tonic-gate 	yyval = p2;
45*364Sceastha 	lfont[yyval] = rfont[yyval] = ft == ITAL ? ITAL : ROM;
46*364Sceastha 	if (dbg)
47*364Sceastha 		printf(".\tb:fb: S%d <- \\f%c S%d \\f%c b=%d,h=%d,lf=%c,"
48*364Sceastha 		    "rf=%c\n", yyval, ft, p2, p1, ebase[yyval], eht[yyval],
49*364Sceastha 		    lfont[yyval], rfont[yyval]);
50*364Sceastha 	printf(".ds %d \\f%c\\*(%d\\f%c\n", yyval, ft, p2, p1);
510Sstevel@tonic-gate 	ft = p1;
520Sstevel@tonic-gate 	printf(".ft %c\n", ft);
530Sstevel@tonic-gate }
540Sstevel@tonic-gate 
55*364Sceastha void
fatbox(int p)56*364Sceastha fatbox(int p)
57*364Sceastha {
580Sstevel@tonic-gate 	yyval = p;
590Sstevel@tonic-gate 	nrwid(p, ps, p);
600Sstevel@tonic-gate 	printf(".ds %d \\*(%d\\h'-\\n(%du+0.05m'\\*(%d\n", p, p, p, p);
61*364Sceastha 	if (dbg) printf(".\tfat %d, sh=0.05m\n", p);
620Sstevel@tonic-gate }
630Sstevel@tonic-gate 
64*364Sceastha void
globfont(void)65*364Sceastha globfont(void)
66*364Sceastha {
670Sstevel@tonic-gate 	char temp[20];
680Sstevel@tonic-gate 
69*364Sceastha 	(void) getstr(temp, 20);
700Sstevel@tonic-gate 	yyval = eqnreg = 0;
710Sstevel@tonic-gate 	gfont = temp[0];
720Sstevel@tonic-gate 	switch (gfont) {
730Sstevel@tonic-gate 	case 'r': case 'R':
740Sstevel@tonic-gate 		gfont = '1';
750Sstevel@tonic-gate 		break;
760Sstevel@tonic-gate 	case 'i': case 'I':
770Sstevel@tonic-gate 		gfont = '2';
780Sstevel@tonic-gate 		break;
790Sstevel@tonic-gate 	case 'b': case 'B':
800Sstevel@tonic-gate 		gfont = '3';
810Sstevel@tonic-gate 		break;
820Sstevel@tonic-gate 	}
830Sstevel@tonic-gate 	printf(".ft %c\n", gfont);
840Sstevel@tonic-gate 	ft = gfont;
850Sstevel@tonic-gate }
86