xref: /titanic_41/usr/src/cmd/eqn/font.c (revision 779fc935796a940997d18b31d64a9fec9c6b40f6)
1*779fc935Sceastha /*
2*779fc935Sceastha  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*779fc935Sceastha  * Use is subject to license terms.
4*779fc935Sceastha  */
5*779fc935Sceastha 
67c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
77c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
87c478bd9Sstevel@tonic-gate 
97c478bd9Sstevel@tonic-gate /*
107c478bd9Sstevel@tonic-gate  * Copyright (c) 1980 Regents of the University of California.
117c478bd9Sstevel@tonic-gate  * All rights reserved. The Berkeley software License Agreement
127c478bd9Sstevel@tonic-gate  * specifies the terms and conditions for redistribution.
137c478bd9Sstevel@tonic-gate  */
147c478bd9Sstevel@tonic-gate 
15*779fc935Sceastha #pragma ident	"%Z%%M%	%I%	%E% SMI"
167c478bd9Sstevel@tonic-gate 
177c478bd9Sstevel@tonic-gate #include "e.h"
187c478bd9Sstevel@tonic-gate 
19*779fc935Sceastha void
setfont(char ch1)20*779fc935Sceastha setfont(char ch1)
21*779fc935Sceastha {
227c478bd9Sstevel@tonic-gate 	/* use number '1', '2', '3' for roman, italic, bold */
237c478bd9Sstevel@tonic-gate 	yyval = ft;
247c478bd9Sstevel@tonic-gate 	if (ch1 == 'r' || ch1 == 'R')
257c478bd9Sstevel@tonic-gate 		ft = ROM;
267c478bd9Sstevel@tonic-gate 	else if (ch1 == 'i' || ch1 == 'I')
277c478bd9Sstevel@tonic-gate 		ft = ITAL;
287c478bd9Sstevel@tonic-gate 	else if (ch1 == 'b' || ch1 == 'B')
297c478bd9Sstevel@tonic-gate 		ft = BLD;
307c478bd9Sstevel@tonic-gate 	else
317c478bd9Sstevel@tonic-gate 		ft = ch1;
327c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", ft);
337c478bd9Sstevel@tonic-gate #ifndef NEQN
347c478bd9Sstevel@tonic-gate 	if (dbg) printf(".\tsetfont %c %c\n", ch1, ft);
35*779fc935Sceastha #else	/* NEQN */
367c478bd9Sstevel@tonic-gate 	if (dbg) printf(".\tsetfont %c\n", ft);
37*779fc935Sceastha #endif	/* NEQN */
387c478bd9Sstevel@tonic-gate }
397c478bd9Sstevel@tonic-gate 
40*779fc935Sceastha void
font(int p1,int p2)41*779fc935Sceastha font(int p1, int p2)
42*779fc935Sceastha {
437c478bd9Sstevel@tonic-gate 		/* old font in p1, new in ft */
447c478bd9Sstevel@tonic-gate 	yyval = p2;
457c478bd9Sstevel@tonic-gate 	lfont[yyval] = rfont[yyval] = ft == ITAL ? ITAL : ROM;
46*779fc935Sceastha 	if (dbg)
47*779fc935Sceastha 		printf(".\tb:fb: S%d <- \\f%c S%d \\f%c b=%d,h=%d,lf=%c,"
48*779fc935Sceastha 		    "rf=%c\n", yyval, ft, p2, p1, ebase[yyval], eht[yyval],
49*779fc935Sceastha 		    lfont[yyval], rfont[yyval]);
50*779fc935Sceastha 	printf(".ds %d \\f%c\\*(%d\\f%c\n", yyval, ft, p2, p1);
517c478bd9Sstevel@tonic-gate 	ft = p1;
527c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", ft);
537c478bd9Sstevel@tonic-gate }
547c478bd9Sstevel@tonic-gate 
55*779fc935Sceastha void
fatbox(int p)56*779fc935Sceastha fatbox(int p)
57*779fc935Sceastha {
587c478bd9Sstevel@tonic-gate 	yyval = p;
597c478bd9Sstevel@tonic-gate 	nrwid(p, ps, p);
607c478bd9Sstevel@tonic-gate 	printf(".ds %d \\*(%d\\h'-\\n(%du+0.05m'\\*(%d\n", p, p, p, p);
617c478bd9Sstevel@tonic-gate 	if (dbg) printf(".\tfat %d, sh=0.05m\n", p);
627c478bd9Sstevel@tonic-gate }
637c478bd9Sstevel@tonic-gate 
64*779fc935Sceastha void
globfont(void)65*779fc935Sceastha globfont(void)
66*779fc935Sceastha {
677c478bd9Sstevel@tonic-gate 	char temp[20];
687c478bd9Sstevel@tonic-gate 
69*779fc935Sceastha 	(void) getstr(temp, 20);
707c478bd9Sstevel@tonic-gate 	yyval = eqnreg = 0;
717c478bd9Sstevel@tonic-gate 	gfont = temp[0];
727c478bd9Sstevel@tonic-gate 	switch (gfont) {
737c478bd9Sstevel@tonic-gate 	case 'r': case 'R':
747c478bd9Sstevel@tonic-gate 		gfont = '1';
757c478bd9Sstevel@tonic-gate 		break;
767c478bd9Sstevel@tonic-gate 	case 'i': case 'I':
777c478bd9Sstevel@tonic-gate 		gfont = '2';
787c478bd9Sstevel@tonic-gate 		break;
797c478bd9Sstevel@tonic-gate 	case 'b': case 'B':
807c478bd9Sstevel@tonic-gate 		gfont = '3';
817c478bd9Sstevel@tonic-gate 		break;
827c478bd9Sstevel@tonic-gate 	}
837c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", gfont);
847c478bd9Sstevel@tonic-gate 	ft = gfont;
857c478bd9Sstevel@tonic-gate }
86