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