font.c revision 364:f36290b8cb0b
1492SN/A/*
21929Sihse * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3492SN/A * Use is subject to license terms.
4492SN/A */
5492SN/A
6492SN/A/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
7492SN/A/*	  All Rights Reserved  	*/
8492SN/A
9492SN/A/*
10492SN/A * Copyright (c) 1980 Regents of the University of California.
11492SN/A * All rights reserved. The Berkeley software License Agreement
12492SN/A * specifies the terms and conditions for redistribution.
13492SN/A */
14492SN/A
15492SN/A#pragma ident	"%Z%%M%	%I%	%E% SMI"
16492SN/A
17492SN/A#include "e.h"
18492SN/A
19492SN/Avoid
20492SN/Asetfont(char ch1)
21492SN/A{
22492SN/A	/* use number '1', '2', '3' for roman, italic, bold */
23492SN/A	yyval = ft;
24492SN/A	if (ch1 == 'r' || ch1 == 'R')
25492SN/A		ft = ROM;
261120Schegar	else if (ch1 == 'i' || ch1 == 'I')
271120Schegar		ft = ITAL;
281120Schegar	else if (ch1 == 'b' || ch1 == 'B')
291410Sihse		ft = BLD;
301120Schegar	else
311120Schegar		ft = ch1;
321120Schegar	printf(".ft %c\n", ft);
33492SN/A#ifndef NEQN
341410Sihse	if (dbg) printf(".\tsetfont %c %c\n", ch1, ft);
351410Sihse#else	/* NEQN */
361410Sihse	if (dbg) printf(".\tsetfont %c\n", ft);
371410Sihse#endif	/* NEQN */
38492SN/A}
39492SN/A
40492SN/Avoid
411410Sihsefont(int p1, int p2)
421120Schegar{
43837SN/A		/* old font in p1, new in ft */
44910Sihse	yyval = p2;
451131Serikj	lfont[yyval] = rfont[yyval] = ft == ITAL ? ITAL : ROM;
46492SN/A	if (dbg)
471120Schegar		printf(".\tb:fb: S%d <- \\f%c S%d \\f%c b=%d,h=%d,lf=%c,"
481236Sihse		    "rf=%c\n", yyval, ft, p2, p1, ebase[yyval], eht[yyval],
491120Schegar		    lfont[yyval], rfont[yyval]);
501120Schegar	printf(".ds %d \\f%c\\*(%d\\f%c\n", yyval, ft, p2, p1);
511120Schegar	ft = p1;
52968Sihse	printf(".ft %c\n", ft);
53968Sihse}
54492SN/A
551120Schegarvoid
561804Serikjfatbox(int p)
571120Schegar{
581120Schegar	yyval = p;
591120Schegar	nrwid(p, ps, p);
601120Schegar	printf(".ds %d \\*(%d\\h'-\\n(%du+0.05m'\\*(%d\n", p, p, p, p);
611120Schegar	if (dbg) printf(".\tfat %d, sh=0.05m\n", p);
621120Schegar}
631120Schegar
641120Schegarvoid
651120Schegarglobfont(void)
661120Schegar{
671120Schegar	char temp[20];
681223Schegar
691223Schegar	(void) getstr(temp, 20);
701223Schegar	yyval = eqnreg = 0;
711120Schegar	gfont = temp[0];
721120Schegar	switch (gfont) {
731120Schegar	case 'r': case 'R':
741120Schegar		gfont = '1';
751120Schegar		break;
761120Schegar	case 'i': case 'I':
771600Snaoto		gfont = '2';
781600Snaoto		break;
791600Snaoto	case 'b': case 'B':
801223Schegar		gfont = '3';
811862Serikj		break;
821120Schegar	}
831659Serikj	printf(".ft %c\n", gfont);
841600Snaoto	ft = gfont;
851120Schegar}
861120Schegar