|
|
1.1 root 1: #
2:
3: #
4:
5: /*
6: * Creates a width table for troff from a versatec font for a
7: * normal font.
8: * Usage: width font point_size
9: * where font is the file name of the versatec font and
10: * point_size is it point size.
11: * It is better to use as large a point size font as possible
12: * to avoid round off.
13: */
14:
15: struct wtable
16: {
17: char charloc;
18: char *name;
19: } wtable[]
20: {
21: '\214', "space",
22: '!', "!",
23: '"', "\"",
24: '#', "#",
25: '$', "$",
26: '%', "%",
27: '&', "&",
28: '\'', "'",
29: '(', "(",
30: ')', ")",
31: '*', "*",
32: '+', "+",
33: ',', ",",
34: '-', "- hyphen",
35: '.', ".",
36: '/', "/",
37: '0', "0",
38: '1', "1",
39: '2', "2",
40: '3', "3",
41: '4', "4",
42: '5', "5",
43: '6', "6",
44: '7', "7",
45: '8', "8",
46: '9', "9",
47: ':', ":",
48: ';', ";",
49: '<', "<",
50: '=', "=",
51: '>', ">",
52: '?', "?",
53: '@', "@",
54: 'A', "A",
55: 'B', "B",
56: 'C', "C",
57: 'D', "D",
58: 'E', "E",
59: 'F', "F",
60: 'G', "G",
61: 'H', "H",
62: 'I', "I",
63: 'J', "J",
64: 'K', "K",
65: 'L', "L",
66: 'M', "M",
67: 'N', "N",
68: 'O', "O",
69: 'P', "P",
70: 'Q', "Q",
71: 'R', "R",
72: 'S', "S",
73: 'T', "T",
74: 'U', "U",
75: 'V', "V",
76: 'W', "W",
77: 'X', "X",
78: 'Y', "Y",
79: 'Z', "Z",
80: '[', "[",
81: '\\', "\\",
82: ']', "]",
83: '^', "^",
84: '_', "_",
85: '\`', "\`",
86: 'a', "a",
87: 'b', "b",
88: 'c', "c",
89: 'd', "d",
90: 'e', "e",
91: 'f', "f",
92: 'g', "g",
93: 'h', "h",
94: 'i', "i",
95: 'j', "j",
96: 'k', "k",
97: 'l', "l",
98: 'm', "m",
99: 'n', "n",
100: 'o', "o",
101: 'p', "p",
102: 'q', "q",
103: 'r', "r",
104: 's', "s",
105: 't', "t",
106: 'u', "u",
107: 'v', "v",
108: 'w', "w",
109: 'x', "x",
110: 'y', "y",
111: 'z', "z",
112: '{', "{",
113: '|', "|",
114: '}', "}",
115: '~', "~",
116: '\206', "narrow space",
117: '-', "hyphen",
118: '\07', "bullet",
119: '\010', "square",
120: '\06', "3/4 em dash",
121: '\05', "rule",
122: '\021', "1/4",
123: '\022', "1/2",
124: '\023', "3/4",
125: '\04', "minus",
126: '\01', "fi",
127: '\02', "fl",
128: '\03', "ff",
129: '\011', "ffi",
130: '\012', "ffl",
131: '\013', "degree",
132: '\014', "dagger",
133: '\200', "section (unimplem)",
134: '\015', "foot mark",
135: '\200', "acute acc (unimplem)",
136: '\200', "grave acc (unimplem)",
137: '\200', "underrule (unimplem)",
138: '\200', "slash (unimplem)",
139: '\203', "half narrow space",
140: '\200', "null",
141: '\200', "null",
142: '\200', "null",
143: '\200', "null",
144: '\200', "null",
145: '\200', "null",
146: '\200', "null",
147: '\200', "null",
148: '\200', "null",
149: '\200', "null",
150: '\200', "null",
151: '\200', "null",
152: '\200', "null",
153: '\200', "null",
154: '\200', "null",
155: '\200', "null",
156: '\200', "null",
157: '\200', "null",
158: '\200', "null",
159: '\200', "null",
160: '\200', "null",
161: '\200', "null",
162: '\200', "null",
163: '\200', "null",
164: '\200', "null",
165: '\200', "null",
166: '\200', "null",
167: '\200', "null",
168: '\200', "null",
169: '\200', "null",
170: '\200', "null",
171: '\200', "null",
172: '\200', "null",
173: '\200', "null",
174: '\200', "null",
175: '\200', "null",
176: '\200', "null",
177: '\200', "null",
178: '\200', "null",
179: '\200', "null",
180: '\200', "null",
181: '\200', "null",
182: '\200', "null",
183: '\200', "null",
184: '\200', "null",
185: '\200', "null",
186: '\200', "null",
187: '\200', "null",
188: '\200', "null",
189: '\200', "null",
190: '\200', "null",
191: '\200', "null",
192: '\200', "null",
193: '\200', "null",
194: '\200', "null",
195: '\200', "null",
196: '\200', "null",
197: '\200', "null",
198: '\200', "null",
199: '\200', "null",
200: '\200', "null",
201: '\200', "null",
202: '\200', "null",
203: '\200', "null",
204: '\200', "null",
205: '\200', "null",
206: '\200', "null",
207: '\200', "null",
208: '\200', "null",
209: '\200', "null",
210: '\200', "null",
211: '\017', "registered",
212: '\016', "copyright",
213: '\200', "null",
214: '\020', "cent",
215: 0, 0
216: };
217:
218: struct desc
219: {
220: short addr;
221: short nbytes;
222: char up;
223: char down;
224: char left;
225: char right;
226: short width;
227: } desc[256];
228:
229: main(argc, argv)
230: int argc;
231: char *argv[];
232: {
233: register int cl;
234: register esc;
235: register w;
236: int i, psize;
237: int fd, high;
238:
239: if(argc != 3)
240: {
241: printf("arg count\n");
242: exit();
243: }
244: fd = open(argv[1], 0);
245: psize = atoi(argv[2]);
246: lseek(fd, 10, 0);
247: read(fd, &desc, sizeof desc);
248: high = desc['a'].up+1;
249: printf("char XXw[256-32] {\n");
250: for(i = 0; wtable[i].charloc != 0; i++)
251: {
252: cl = wtable[i].charloc & 0377;
253: if(cl & 0200)
254: w = cl & 0177;
255: else
256: w = desc[cl].width*(54./25.)*(6./psize)+.5;
257: esc = 0;
258: if((cl >= '0' && cl <= '9') || (cl >= 'A' && cl <= 'Z') ||
259: (cl >= 'a' && cl <= 'z'))
260: {
261: if(desc[cl].up > high)
262: esc =| 0200;
263: if(desc[cl].down > 0)
264: esc =| 0100;
265: }
266: if(esc)
267: printf("%d+0%o,\t/* %s */\n", w, esc, wtable[i].name);
268: else
269: printf("%d,\t\t/* %s */\n", w, wtable[i].name);
270: }
271: printf("};\n");
272: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.