Annotation of 43BSDReno/usr.bin/roff/troff_font/mkfont.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char sccsid[] = "@(#)mkfont.c   4.3 2/16/88";
                      3: #endif lint
                      4: 
                      5: #include "mkfont1.c"
                      6: 
                      7: /*
                      8:   this program takes 102 width values
                      9:   (one per line) in the order provided bu Graphic
                     10:   Systems and prepares a C-compileable width table.
                     11: */
                     12: char ibuf[512];
                     13: int id;
                     14: int width[102];
                     15: int ascii[102];
                     16: int zero;
                     17: int emw, hyw;
                     18: int xxx;
                     19: 
                     20: main(argc,argv)
                     21: int argc;
                     22: char **argv;
                     23: {
                     24:        register i, j;
                     25:        register char *p;
                     26: 
                     27:        while((--argc > 0) && ((++argv)[0][0]=='-')){
                     28:                switch(argv[0][1]){
                     29:                        default:
                     30:                                continue;
                     31:                }
                     32:        }
                     33:        if(argc){
                     34:                if((id=open(argv[0],0)) < 0){
                     35:                        printf("Cannot open: %s.\n",argv[0]);
                     36:                        exit(1);
                     37:                }
                     38:        }
                     39:        j = read(id,ibuf,512);
                     40:        p = ibuf;
                     41:        for(i=0; i<102; i++){
                     42:                width[i] = atoi(p);
                     43:                while(*p++ != '\n');
                     44:        }
                     45:        for(i=0; i<102; i++){
                     46:                if(font[i].name < 0177){
                     47:                        ascii[i] = font[i].name;
                     48:                }else{
                     49:                        for(j=0; chtab[j] != 0; j += 2){
                     50:                                if(font[i].name == chtab[j])break;
                     51:                        }
                     52:                        ascii[i] = chtab[j+1] & 0377;
                     53:                        if(chtab[j] == PAIR('h','y')) hyw = width[i];
                     54:                        if(chtab[j] == PAIR('e','m')) emw = width[i];
                     55:                }
                     56:        }
                     57:        printf("char XXw[256-32] {\t/*XX*/\n");
                     58:        for(i=040; i<256; i++){
                     59:                if(i == 0377){
                     60:                        printf("0};\n");
                     61:                        break;
                     62:                }
                     63:                if(i == 0177){
                     64:                        printf("6,\t %s\n",nametab[i-040]);
                     65:                        continue;
                     66:                }
                     67:                if(i == 0226){
                     68:                        printf("3,\t %s\n",nametab[i-040]);
                     69:                        continue;
                     70:                }
                     71:                if(i == ' '){
                     72:                        printf("12,\t %s\n",nametab[i-040]);
                     73:                        continue;
                     74:                }
                     75:                if(i == '-'){
                     76:                        printf("%d,\t %s\n",hyw,nametab[i-040]);
                     77:                        continue;
                     78:                }
                     79:                for(j=0; j<102; j++){
                     80:                        if(ascii[j] == i)break;
                     81:                }
                     82:                if(j == 102){
                     83:                        printf("0,");
                     84:                        zero++;
                     85:                        if(nametab[i-040]){
                     86:                                printf("\t %s\n",nametab[i-040]);
                     87:                                zero = 0;
                     88:                        }else if(i < 0177){
                     89:                                printf("\t /*%c*/\n",i);
                     90:                                zero = 0;
                     91:                        }
                     92:                        if(zero && !((i+1)%8)){
                     93:                                printf("\n");
                     94:                                zero = 0;
                     95:                        }
                     96:                }else{
                     97:                        if(zero){
                     98:                                zero = 0;
                     99:                                printf("\n");
                    100:                        }
                    101:                        printf("%d",width[j]);
                    102:                        if(font[j].ctval)printf("+0%d00, ",font[j].ctval);
                    103:                        else printf(",\t ");
                    104:                        printf("%s\n",nametab[i-040]);
                    105:                }
                    106:        }
                    107: }

unix.superglobalmegacorp.com

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