1 #ifndef lint 2 static char sccsid[] = "@(#)font.c 2.2 (CWI) 87/04/01"; 3 #endif lint 4 # include "e.h" 5 6 setfont(ch1) 7 char *ch1; 8 { 9 yyval = ft; 10 if (strcmp(ch1, "I") == 0) { /* I and italic mean merely position 2 */ 11 *ch1 = '2'; 12 ft = ITAL; 13 } else if (strcmp(ch1, "B") == 0) { /* and similarly for B & bold */ 14 *ch1 = '3'; 15 ft = BLD; 16 } else if (strcmp(ch1, "R") == 0) { /* and R and roman */ 17 *ch1 = '1'; 18 ft = ROM; 19 } else { 20 ft = ROM; /* assume it's a roman style */ 21 } 22 ftp++; 23 if (ftp >= &ftstack[10]) 24 error(FATAL, "font stack overflow"); 25 ftp->ft = ft; 26 if (ch1[1] == 0) { /* 1-char name */ 27 ftp->name[0] = *ch1; 28 ftp->name[1] = '\0'; 29 } else 30 sprintf(ftp->name, "(%s", ch1); 31 dprintf(".\tsetfont %s %c\n", ch1, ft); 32 } 33 34 font(p1, p2) 35 int p1, p2; 36 { 37 /* old font in p1, new in ft */ 38 yyval = p2; 39 lfont[yyval] = rfont[yyval] = ft==ITAL ? ITAL : ROM; 40 ftp--; 41 ft = p1; 42 } 43 44 globfont() 45 { 46 char temp[20]; 47 48 getstr(temp, sizeof(temp)); 49 yyval = eqnreg = 0; 50 if (strcmp(temp, "I") == 0 || strncmp(temp, "it", 2) == 0) { 51 ft = ITAL; 52 strcpy(temp, "2"); 53 } else if (strcmp(temp, "B") == 0 || strncmp(temp, "bo", 2) == 0) { 54 ft = BLD; 55 strcpy(temp, "3"); 56 } else if (strcmp(temp, "R") == 0 || strncmp(temp, "ro", 2) == 0) { 57 ft = ROM; 58 strcpy(temp, "1"); 59 } else { 60 ft = ROM; /* assume it's a roman style */ 61 } 62 ftstack[0].ft = ft; 63 if (temp[1] == 0) /* 1-char name */ 64 strcpy(ftstack[0].name, temp); 65 else 66 sprintf(ftstack[0].name, "(%.2s", temp); 67 } 68 69 fatbox(p) 70 int p; 71 { 72 extern float Fatshift; 73 74 yyval = p; 75 printf(".ds %d \\*(%d\\h'-\\w'\\*(%d'u+%gm'\\*(%d\n", p, p, p, Fatshift, p); 76 } 77