xref: /illumos-gate/usr/src/cmd/eqn/font.c (revision 2a8bcb4e)
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 #include "e.h"
167c478bd9Sstevel@tonic-gate 
17*779fc935Sceastha void
setfont(char ch1)18*779fc935Sceastha setfont(char ch1)
19*779fc935Sceastha {
207c478bd9Sstevel@tonic-gate 	/* use number '1', '2', '3' for roman, italic, bold */
217c478bd9Sstevel@tonic-gate 	yyval = ft;
227c478bd9Sstevel@tonic-gate 	if (ch1 == 'r' || ch1 == 'R')
237c478bd9Sstevel@tonic-gate 		ft = ROM;
247c478bd9Sstevel@tonic-gate 	else if (ch1 == 'i' || ch1 == 'I')
257c478bd9Sstevel@tonic-gate 		ft = ITAL;
267c478bd9Sstevel@tonic-gate 	else if (ch1 == 'b' || ch1 == 'B')
277c478bd9Sstevel@tonic-gate 		ft = BLD;
287c478bd9Sstevel@tonic-gate 	else
297c478bd9Sstevel@tonic-gate 		ft = ch1;
307c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", ft);
317c478bd9Sstevel@tonic-gate #ifndef NEQN
32*779fc935Sceastha 	if (dbg) printf(".\tsetfont %c %c\n", ch1, ft);
33*779fc935Sceastha #else	/* NEQN */
34*779fc935Sceastha 	if (dbg) printf(".\tsetfont %c\n", ft);
35*779fc935Sceastha #endif	/* NEQN */
367c478bd9Sstevel@tonic-gate }
377c478bd9Sstevel@tonic-gate 
38*779fc935Sceastha void
font(int p1,int p2)39*779fc935Sceastha font(int p1, int p2)
40*779fc935Sceastha {
417c478bd9Sstevel@tonic-gate 		/* old font in p1, new in ft */
427c478bd9Sstevel@tonic-gate 	yyval = p2;
43*779fc935Sceastha 	lfont[yyval] = rfont[yyval] = ft == ITAL ? ITAL : ROM;
44*779fc935Sceastha 	if (dbg)
45*779fc935Sceastha 		printf(".\tb:fb: S%d <- \\f%c S%d \\f%c b=%d,h=%d,lf=%c,"
46*779fc935Sceastha 		    "rf=%c\n", yyval, ft, p2, p1, ebase[yyval], eht[yyval],
47*779fc935Sceastha 		    lfont[yyval], rfont[yyval]);
48*779fc935Sceastha 	printf(".ds %d \\f%c\\*(%d\\f%c\n", yyval, ft, p2, p1);
497c478bd9Sstevel@tonic-gate 	ft = p1;
507c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", ft);
517c478bd9Sstevel@tonic-gate }
527c478bd9Sstevel@tonic-gate 
53*779fc935Sceastha void
fatbox(int p)54*779fc935Sceastha fatbox(int p)
55*779fc935Sceastha {
567c478bd9Sstevel@tonic-gate 	yyval = p;
577c478bd9Sstevel@tonic-gate 	nrwid(p, ps, p);
587c478bd9Sstevel@tonic-gate 	printf(".ds %d \\*(%d\\h'-\\n(%du+0.05m'\\*(%d\n", p, p, p, p);
59*779fc935Sceastha 	if (dbg) printf(".\tfat %d, sh=0.05m\n", p);
607c478bd9Sstevel@tonic-gate }
617c478bd9Sstevel@tonic-gate 
62*779fc935Sceastha void
globfont(void)63*779fc935Sceastha globfont(void)
64*779fc935Sceastha {
657c478bd9Sstevel@tonic-gate 	char temp[20];
667c478bd9Sstevel@tonic-gate 
67*779fc935Sceastha 	(void) getstr(temp, 20);
687c478bd9Sstevel@tonic-gate 	yyval = eqnreg = 0;
697c478bd9Sstevel@tonic-gate 	gfont = temp[0];
707c478bd9Sstevel@tonic-gate 	switch (gfont) {
717c478bd9Sstevel@tonic-gate 	case 'r': case 'R':
727c478bd9Sstevel@tonic-gate 		gfont = '1';
737c478bd9Sstevel@tonic-gate 		break;
747c478bd9Sstevel@tonic-gate 	case 'i': case 'I':
757c478bd9Sstevel@tonic-gate 		gfont = '2';
767c478bd9Sstevel@tonic-gate 		break;
777c478bd9Sstevel@tonic-gate 	case 'b': case 'B':
787c478bd9Sstevel@tonic-gate 		gfont = '3';
797c478bd9Sstevel@tonic-gate 		break;
807c478bd9Sstevel@tonic-gate 	}
817c478bd9Sstevel@tonic-gate 	printf(".ft %c\n", gfont);
827c478bd9Sstevel@tonic-gate 	ft = gfont;
837c478bd9Sstevel@tonic-gate }
84