Annotation of researchv9/cmd/eqn/font.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.