Debian Codegraph @

texk/web2c/omegafonts/font_routines.c

raw
1 /* font_routines.c: Data structures for virtual font support
2
3 This file is part of Omega,
4 which is based on the web2c distribution of TeX,
5
6 Copyright (C) 1994--2001 John Plaice and Yannis Haralambous
7 Copyright (C) 2005, 2006 Roozbeh Pournader
8
9 Omega is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 Omega is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with Omega; if not, write to the Free Software Foundation, Inc.,
21 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22
23 */
24
25 #include "cpascal.h"
26 #include "manifests.h"
27 #include "dvi.h"
28 #include "error_routines.h"
29 #include "list_routines.h"
30 #include "font_routines.h"
31 #include "char_routines.h"
32 #include "header_routines.h"
33 #include "print_routines.h"
34 #include "out_routines.h"
35 #include "omfonts.h"
36
37 #define BLOCK 16
38
39 font *font_table = NULL;
40 unsigned font_table_size = 0;
41 unsigned no_fonts = 0;
42 font *cur_font = NULL;
43 unsigned cur_font_index = 0;
44
45 unsigned vtitle_length = 0;
46 unsigned vf_check_sum = 0;
47 unsigned vf_design_size = 0;
48
49 void
50 font_table_init(void)
51 {
52 if (font_table == NULL) {
53 font_table_size = BLOCK;
54 font_table = (font *) xmalloc(font_table_size * sizeof(font));
55 }
56 no_fonts = 0;
57 }
58
59 static void
60 font_no_incr(void)
61 {
62 if (no_fonts == font_table_size) {
63 font_table_size += BLOCK;
64 font_table = (font *) xrealloc(font_table, font_table_size * sizeof(font));
65 }
66 no_fonts++;
67 }
68
69 static void
70 clear_map_font(int font_number)
71 {
72 if (cur_font==NULL) internal_error_0("clear_map_font");
73 cur_font->font_number = font_number;
74 cur_font->font_name = NULL;
75 cur_font->font_area = NULL;
76 cur_font->font_at = design_units;
77 cur_font->font_checksum = 0;
78 cur_font->font_dsize = 10*UNITY;
79 cur_font->font_at_defined = FALSE;
80 cur_font->font_checksum_defined = FALSE;
81 cur_font->font_dsize_defined = FALSE;
82 cur_font->ovf_packet = NULL;
83 cur_font->ovf_packet_length = 0;
84 }
85
86 static void append_command(unsigned, unsigned);
87 static void packet_table_init(void);
88 static void packet_table_end(void);
89
90 void
91 init_map_font(int font_number)
92 {
93 unsigned i=0;
94
95 while (i<no_fonts) {
96 if (font_number == font_table[i].font_number) {
97 warning_1("MAPFONT index (D %d) previously defined; "
98 "old definition ignored", font_number);
99 cur_font = &font_table[i];
100 if (cur_font->font_area != NULL)
101 free(cur_font->font_area);
102 if (cur_font->font_name != NULL)
103 free(cur_font->font_name);
104 if (cur_font->ovf_packet != NULL)
105 free(cur_font->ovf_packet);
106 clear_map_font(font_number);
107 break;
108 }
109 i++;
110 }
111 if (i==no_fonts) {
112 font_no_incr();
113 cur_font = &font_table[i];
114 clear_map_font(font_number);
115 }
116 packet_table_init();
117 append_command(DVI_FNT_DEF_1, i);
118 cur_font_index = i;
119 cur_font = &font_table[i];
120 cur_font->ovf_packet = cur_packet;
121 cur_font->ovf_packet_length = packet_ptr;
122 packet_table_end();
123
124 }
125
126 void
127 set_font_name(string name)
128 {
129 if (cur_font==NULL) {
130 internal_error_0("set_font_name");
131 }
132 if (cur_font->font_name != NULL) {
133 warning_0("FONTNAME previously defined; old value ignored");
134 free(cur_font->font_name);
135 cur_font->font_name=NULL;
136 }
137 cur_font->font_name = name;
138 }
139
140 void
141 set_font_area(string area)
142 {
143 if (cur_font==NULL) {
144 internal_error_0("set_font_area");
145 }
146 if (cur_font->font_area != NULL) {
147 warning_0("FONTAREA previously defined; old value ignored");
148 free(cur_font->font_area);
149 cur_font->font_area=NULL;
150 }
151 cur_font->font_area = area;
152 }
153
154 void
155 set_font_check_sum(unsigned cs)
156 {
157 if (cur_font==NULL) {
158 internal_error_0("set_font_check_sum");
159 }
160 if (cur_font->font_checksum_defined != FALSE) {
161 warning_0("FONTCHECKSUM previously defined; old value ignored");
162 }
163 cur_font->font_checksum = cs;
164 cur_font->font_checksum_defined = TRUE;
165 }
166
167 void
168 set_font_at(fix at)
169 {
170 if (cur_font==NULL) {
171 internal_error_0("set_font_at");
172 }
173 if (cur_font->font_at_defined != FALSE) {
174 warning_0("FONTAT previously defined; old value ignored");
175 }
176 cur_font->font_at = at;
177 cur_font->font_at_defined = TRUE;
178 }
179
180 void
181 set_font_design_size(fix ds)
182 {
183 if (cur_font==NULL) {
184 internal_error_0("set_font_design_size");
185 }
186 if (cur_font->font_dsize_defined != FALSE) {
187 warning_0("FONTDSIZE previously defined; old value ignored");
188 }
189 cur_font->font_dsize = ds;
190 cur_font->font_dsize_defined = TRUE;
191 }
192
193 string vtitle = NULL;
194
195 void
196 set_vtitle(string title)
197 {
198 if (vtitle!=NULL) {
199 warning_0("VTITLE previously defined; old value ignored");
200 free(vtitle); vtitle = NULL;
201 }
202 vtitle = title;
203 }
204
205 unsigned packet_table_size = 0;
206 unsigned char *packet_table = NULL;
207 unsigned char *cur_packet = NULL;
208 unsigned packet_ptr = 0;
209
210 static void
211 packet_table_init(void)
212 {
213 packet_table_size = BLOCK;
214 packet_table = (unsigned char *) xmalloc(packet_table_size);
215 packet_ptr = 0;
216 cur_packet = packet_table;
217 }
218
219 static void
220 packet_ptr_incr(void)
221 {
222 if (packet_ptr == packet_table_size) {
223 packet_table_size += BLOCK;
224 packet_table = (unsigned char *)
225 xrealloc(packet_table, packet_table_size);
226 cur_packet = packet_table;
227 }
228 packet_ptr++;
229 }
230
231 static void
232 append_to_packet(unsigned val)
233 {
234 packet_ptr_incr();
235 packet_table[packet_ptr-1] = val & 0xff;
236 }
237
238 static void move_table_init(void);
239
240 void
241 init_map(void)
242 {
243 move_table_init();
244 packet_table_init();
245 }
246
247 void
248 end_map(void)
249 {
250 current_character->ovf_packet = cur_packet;
251 current_character->ovf_packet_length = packet_ptr;
252 packet_table_end();
253 }
254
255 static void
256 append_command_2(unsigned cmd_0, unsigned max_n,
257 unsigned cmd_1, unsigned actual)
258 {
259 if ((actual < 0) || (actual > 0x7fffffff))
260 internal_error_1("append_command (actual=%d)", actual);
261 if ((cmd_0 + actual) <= max_n)
262 append_to_packet(cmd_0 + actual);
263 else
264 append_command(cmd_1, actual);
265 }
266
267 static void
268 append_command(unsigned cmd_1, unsigned actual)
269 {
270 if ((cmd_1 != DVI_SET_1) && (cmd_1 != DVI_FNT_1) &&
271 (cmd_1 != DVI_FNT_DEF_1) && (cmd_1 != DVI_XXX_1)) {
272 internal_error_1("append_command (cmd_1=%d)", cmd_1);
273 }
274 if (actual < 0x100) {
275 append_to_packet(cmd_1);
276 append_to_packet(actual);
277 } else if (actual < 0x10000) {
278 append_to_packet(cmd_1 + 1);
279 append_to_packet(actual >> 8);
280 append_to_packet(actual & 0xff);
281 } else if (actual < 0x1000000) {
282 append_to_packet(cmd_1 + 2);
283 append_to_packet(actual >> 16);
284 append_to_packet((actual >> 8) & 0xff);
285 append_to_packet(actual & 0xff);
286 } else {
287 append_to_packet(cmd_1 + 3);
288 /* BUG: Should deal with negative numbers */
289 append_to_packet((actual >> 24) & 0xff);
290 append_to_packet((actual >> 16) & 0xff);
291 append_to_packet((actual >> 8) & 0xff);
292 append_to_packet(actual & 0xff);
293 }
294
295 }
296
297 unsigned char *ovf_ptr=NULL;
298
299 int
300 ovf_get_arg(unsigned char **ptr, unsigned k, boolean is_signed)
301 {
302 int a, b;
303
304 if (k>4) internal_error_1("ovf_get_arg (k=%d)", k);
305 a = b = (int) ((**ptr) & 0xff);
306 (*ptr)++;
307 if ((is_signed==TRUE) || (k==4)) { /* 4-byte numbers are signed */
308 if (b > 0x7f) { a = a - 0x100; }
309 }
310 while (k>1) {
311 b = (**ptr) & 0xff;
312 (*ptr)++;
313 a = 0x100 * a + b;
314 k--;
315 }
316 return a;
317 }
318
319 static void
320 input_command(unsigned *cmd, int *actual)
321 {
322 unsigned the_cmd = *ovf_ptr & 0xff;
323
324 ovf_ptr++;
325 if ((the_cmd>=DVI_SET_CHAR_0) && (the_cmd<=DVI_SET_CHAR_127)) {
326 (*cmd)=DVI_SET_1;
327 (*actual) = the_cmd;
328 } else if ((the_cmd>=DVI_SET_1) && (the_cmd<=DVI_SET_4)) {
329 (*cmd)=DVI_SET_1;
330 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_SET_1 + 1, FALSE);
331 } else if ((the_cmd>=DVI_FNT_NUM_0) && (the_cmd<=DVI_FNT_NUM_63)) {
332 (*cmd)=DVI_FNT_1;
333 (*actual) = the_cmd - DVI_FNT_NUM_0;
334 } else if ((the_cmd>=DVI_FNT_1) && (the_cmd<=DVI_FNT_4)) {
335 (*cmd)=DVI_FNT_1;
336 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_FNT_1 + 1, FALSE);
337 } else if ((the_cmd>=DVI_FNT_DEF_1) && (the_cmd<=DVI_FNT_DEF_4)) {
338 (*cmd)=DVI_FNT_DEF_1;
339 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_FNT_DEF_1 + 1, FALSE);
340 } else if ((the_cmd>=DVI_XXX_1) && (the_cmd<=DVI_XXX_4)) {
341 (*cmd)=DVI_XXX_1;
342 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_XXX_1 + 1, FALSE);
343 } else if ((the_cmd>=DVI_RIGHT_1) && (the_cmd<=DVI_RIGHT_4)) {
344 (*cmd)=DVI_RIGHT_1;
345 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_RIGHT_1 + 1, TRUE);
346 } else if ((the_cmd>=DVI_DOWN_1) && (the_cmd<=DVI_DOWN_4)) {
347 (*cmd)=DVI_DOWN_1;
348 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_DOWN_1 + 1, TRUE);
349 } else if ((the_cmd>=DVI_W_1) && (the_cmd<=DVI_W_4)) {
350 (*cmd)=DVI_W_1;
351 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_W_1 + 1, TRUE);
352 } else if ((the_cmd>=DVI_X_1) && (the_cmd<=DVI_X_4)) {
353 (*cmd)=DVI_X_1;
354 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_X_1 + 1, TRUE);
355 } else if ((the_cmd>=DVI_Y_1) && (the_cmd<=DVI_Y_4)) {
356 (*cmd)=DVI_Y_1;
357 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_Y_1 + 1, TRUE);
358 } else if ((the_cmd>=DVI_Z_1) && (the_cmd<=DVI_Z_4)) {
359 (*cmd)=DVI_Z_1;
360 (*actual) = ovf_get_arg(&ovf_ptr, the_cmd - DVI_Z_1 + 1, TRUE);
361 }
362 }
363
364
365 static void
366 append_to_packet_fix(unsigned cmd, fix fval)
367 {
368 unsigned k;
369 unsigned negative=FALSE;
370 int t;
371
372 if (design_units != UNITY)
373 fval = zround(((double)fval) / ((double)design_units) * 1048576.0);
374 if (fval<0) {
375 negative = TRUE;
376 fval = -1 - fval;
377 }
378 if (cmd == 0) {
379 k = 4; t = 0x1000000;
380 } else {
381 t = 0x7f; k = 1;
382 while (fval>t) {
383 t = (t<<8) | 0xff; k++;
384 }
385 append_to_packet(cmd+k-1); t = t/0x80 + 1;
386 }
387 do {
388 if (negative == TRUE) {
389 append_to_packet(0xff - fval/t);
390 fval = (fval/t)*t + t-1-fval;
391 negative = FALSE;
392 } else {
393 append_to_packet((fval/t) & 0xff);
394 }
395 k--; t = t >> 8;
396 } while (k != 0);
397 }
398
399 unsigned move_table_size = 0;
400 move *move_table = NULL;
401 move *cur_move = NULL;
402 unsigned move_ptr = 0;
403
404 static void
405 move_table_init(void)
406 {
407 if (move_table == NULL) {
408 move_table_size = BLOCK;
409 move_table = (move *) xmalloc(move_table_size * sizeof(move));
410 }
411 move_ptr = 0;
412 cur_move = move_table;
413 cur_move->h = 0; cur_move->v = 0;
414 }
415
416 static void
417 packet_table_end(void)
418 {
419 cur_packet = NULL;
420 packet_ptr = 0;
421 packet_table_size = 0;
422 }
423
424
425 static void
426 move_ptr_decr(void)
427 {
428 if (move_ptr==0)
429 internal_error_0("move_ptr_incr");
430 move_ptr--;
431 cur_move = &move_table[move_ptr];
432 }
433
434 static void
435 move_ptr_incr(void)
436 {
437 move_ptr++;
438 if (move_ptr == move_table_size) {
439 move_table_size += BLOCK;
440 move_table = (move *) xrealloc(move_table, move_table_size * sizeof(move));
441 }
442 cur_move = &move_table[move_ptr];
443 }
444
445 static unsigned
446 get_hex(unsigned char c)
447 {
448 if ((c>='0') && (c<='9')) return(c-'0');
449 if ((c<'A') || (c>'F')) {
450 internal_error_1("get_hex (a=%c)", c);
451 }
452 return(c-'A'+10);
453 }
454
455 void
456 set_select_font(unsigned f)
457 {
458 unsigned i;
459
460 for (i = 0; i < no_fonts; i++)
461 if (f == font_table[i].font_number) {
462 append_command_2(DVI_FNT_NUM_0, DVI_FNT_NUM_63, DVI_FNT_1, i);
463 return;
464 }
465
466 internal_error_1("undefined MAPFONT %d cannot be selected", f);
467 }
468
469 void
470 set_set_char(unsigned c)
471 {
472 if (cur_font==NULL) {
473 warning_1("Character (H %X) cannot be typeset in undefined font", c);
474 } else {
475 append_command_2(DVI_SET_CHAR_0, DVI_SET_CHAR_127, DVI_SET_1, c);
476 }
477 }
478
479 void
480 set_set_rule(fix height, fix width)
481 {
482 append_to_packet(DVI_SET_RULE);
483 append_to_packet_fix(0, height);
484 append_to_packet_fix(0, width);
485 }
486
487 void
488 set_move(unsigned direction, fix fval)
489 {
490 if (cur_move == NULL) {
491 internal_error_0("set_move");
492 }
493 if (direction == M_LEFT) {
494 fval = -fval;
495 direction = M_RIGHT;
496 } else if (direction == M_UP) {
497 fval = -fval;
498 direction = M_DOWN;
499 }
500 if (direction == M_RIGHT) { /* horizontal movement */
501 if (cur_move->h == 0) {
502 cur_move->wfix = fval; cur_move->h++;
503 append_to_packet_fix(DVI_W_1, fval);
504 } else if (fval == cur_move->wfix) {
505 append_to_packet(DVI_W_0);
506 } else if (cur_move->h == 1) {
507 cur_move->xfix = fval; cur_move->h++;
508 append_to_packet_fix(DVI_X_1, fval);
509 } else if (fval == cur_move->xfix) {
510 append_to_packet(DVI_X_0);
511 } else {
512 append_to_packet_fix(DVI_RIGHT_1, fval);
513 }
514 } else { /* vertical movement */
515 if (cur_move->v == 0) {
516 cur_move->yfix = fval; cur_move->v++;
517 append_to_packet_fix(DVI_Y_1, fval);
518 } else if (fval == cur_move->yfix) {
519 append_to_packet(DVI_Y_0);
520 } else if (cur_move->v == 1) {
521 cur_move->zfix = fval; cur_move->v++;
522 append_to_packet_fix(DVI_Z_1, fval);
523 } else if (fval == cur_move->zfix) {
524 append_to_packet(DVI_Z_0);
525 } else {
526 append_to_packet_fix(DVI_DOWN_1, fval);
527 }
528 }
529 }
530
531 void
532 set_push(void)
533 {
534 append_to_packet(DVI_PUSH);
535 move_ptr_incr();
536 cur_move->h = 0;
537 cur_move->v = 0;
538 }
539
540 void
541 set_pop(void)
542 {
543 append_to_packet(DVI_POP);
544 move_ptr_decr();
545 }
546
547 void
548 set_special(string special_string)
549 {
550 unsigned len = strlen(special_string);
551 unsigned i=0;
552
553 append_command(DVI_XXX_1, len);
554 for (i=0; i<len; i++) {
555 append_to_packet(special_string[i]);
556 }
557 }
558
559 void
560 set_special_hex(string special_hex_string)
561 {
562 unsigned len = strlen(special_hex_string);
563 unsigned i=0;
564
565 append_command(DVI_XXX_1, len/2);
566 for (i=0; i<len; i+=2) {
567 append_to_packet(get_hex(special_hex_string[i])*16+
568 get_hex(special_hex_string[i+1]));
569 }
570 }
571
572 unsigned file_ovf_count = 0;
573
574 void
575 out_ovf(unsigned i)
576 {
577 fputc(i,file_ovf);
578 file_ovf_count++;
579 }
580
581 void
582 out_ovf_4(unsigned i)
583 {
584 fputc(i>>24, file_ovf);
585 fputc((i>>16)&0xff, file_ovf);
586 fputc((i>>8)&0xff, file_ovf);
587 fputc(i&0xff, file_ovf);
588 file_ovf_count += 4;
589 }
590
591 static void
592 output_ovf_fonts(void)
593 {
594 unsigned i, j, k1, k2;
595
596 for (i=0; i<no_fonts; i++) {
597 cur_font = font_table+i;
598 for (j=0; j<cur_font->ovf_packet_length; j++)
599 out_ovf(cur_font->ovf_packet[j]);
600 out_ovf_4(cur_font->font_checksum);
601 out_ovf_4(cur_font->font_at);
602 out_ovf_4((unsigned int)cur_font->font_dsize);
603 if (cur_font->font_area != NULL) {
604 k2 = strlen(cur_font->font_area);
605 out_ovf(k2);
606 } else {
607 k2 = 0; out_ovf(0);
608 }
609 if (cur_font->font_name != NULL) {
610 k1 = strlen(cur_font->font_name);
611 out_ovf(k1);
612 } else {
613 k1 = 4; out_ovf(4);
614 }
615 if (cur_font->font_area != NULL) {
616 for (j=0; j<k2; j++)
617 out_ovf(cur_font->font_area[j]);
618 }
619 if (cur_font->font_name != NULL) {
620 for (j=0; j<k1; j++)
621 out_ovf(cur_font->font_name[j]);
622 } else {
623 out_ovf('N'); out_ovf('U'); out_ovf('L'); out_ovf('L');
624 }
625 }
626 }
627
628 void
629 output_ovf_file(void)
630 {
631 unsigned i, k;
632
633 out_ovf(DVI_PRE); out_ovf(VF_ID);
634 /* Check for vtitle==NULL by Joel Riou <[email protected]> */
635 k = vtitle ? strlen(vtitle) : 0; out_ovf(k);
636 for (i=0; i<k; i++) out_ovf(vtitle[i]);
637 out_ovf_4(check_sum); out_ovf_4(design_size);
638 output_ovf_fonts();
639 output_ovf_chars();
640 do {
641 out_ovf(DVI_POST);
642 } while ((file_ovf_count % 4) != 0);
643 }
644
645 static void
646 in_ovf_4(int *value)
647 {
648 *value = (((*ovf_ptr) & 0xff) << 24) |
649 (((*(ovf_ptr+1)) & 0xff) << 16) |
650 (((*(ovf_ptr+2)) & 0xff) << 8) |
651 ((*(ovf_ptr+3)) & 0xff);
652 ovf_ptr += 4;
653 }
654
655 static void
656 in_ovf_unsigned_4(unsigned *value)
657 {
658 *value = (((*ovf_ptr) & 0xff) << 24) |
659 (((*(ovf_ptr+1)) & 0xff) << 16) |
660 (((*(ovf_ptr+2)) & 0xff) << 8) |
661 ((*(ovf_ptr+3)) & 0xff);
662 ovf_ptr += 4;
663 }
664
665 static void
666 in_ovf_3(int *value)
667 {
668 *value = (((*ovf_ptr) & 0xff) << 16) |
669 (((*(ovf_ptr+1)) & 0xff) << 8) |
670 ((*(ovf_ptr+2)) & 0xff);
671 ovf_ptr += 3;
672 }
673
674 static void
675 in_ovf(int *value)
676 {
677 *value = (*ovf_ptr) & 0xff;
678 ovf_ptr ++;
679 }
680
681 void
682 input_ovf_file(void)
683 {
684 ovf_ptr = ovf;
685 if ((*ovf_ptr & 0xff) != DVI_PRE)
686 fatal_error_0("Not a VF or OVF file; first byte should be 247");
687 ovf_ptr++;
688 if ((*ovf_ptr & 0xff) != VF_ID)
689 fatal_error_0("Not a VF or OVF file; second byte should be 202");
690 ovf_ptr++;
691 vtitle_length = *ovf_ptr & 0xff;
692 ovf_ptr++;
693 vtitle = (char *) xmalloc(vtitle_length+1);
694 strncpy(vtitle, (const char *)ovf_ptr, vtitle_length);
695 vtitle[vtitle_length] = '\0';
696 ovf_ptr += vtitle_length;
697 print_vtitle(vtitle);
698 in_ovf_unsigned_4(&vf_check_sum);
699 in_ovf_unsigned_4(&vf_design_size);
700 }
701
702
703 void
704 input_ovf_fonts(void)
705 {
706 int cur_font_area_length;
707 int cur_font_name_length;
708 char *cur_font_name;
709 char *cur_font_area;
710 unsigned cur_font_check_sum;
711 int cur_font_at;
712 int cur_font_dsize;
713 unsigned cmd;
714
715 font_table_init();
716 while (((*ovf_ptr & 0xff) >= DVI_FNT_DEF_1) &&
717 ((*ovf_ptr & 0xff) <= DVI_FNT_DEF_4)) {
718 cur_font_index = no_fonts;
719 cur_font = &(font_table[cur_font_index]);
720 font_no_incr();
721 input_command(&cmd, &(cur_font->font_number));
722 print_map_font(cur_font->font_number);
723 in_ovf_unsigned_4(&cur_font_check_sum);
724 cur_font_at = ovf_get_arg(&ovf_ptr, 4, FALSE);
725 cur_font_dsize = ovf_get_arg(&ovf_ptr, 4, FALSE);
726 in_ovf(&cur_font_area_length);
727 in_ovf(&cur_font_name_length);
728 cur_font_area = NULL;
729 if (cur_font_area_length != 0) {
730 cur_font_area = (char *)xmalloc(cur_font_area_length+1);
731 strncpy(cur_font_area, (const char *)ovf_ptr, cur_font_area_length);
732 cur_font_area[cur_font_area_length] = '\0';
733 ovf_ptr += cur_font_area_length;
734 print_font_area(cur_font_area);
735 }
736 cur_font_name = NULL;
737 if (cur_font_name_length != 0) {
738 cur_font_name = (char *)xmalloc(cur_font_name_length+1);
739 strncpy(cur_font_name, (const char *)ovf_ptr, cur_font_name_length);
740 cur_font_name[cur_font_name_length] = '\0';
741 ovf_ptr += cur_font_name_length;
742 print_font_name(cur_font_name);
743 }
744 print_font_check_sum(cur_font_check_sum);
745 print_font_at(cur_font_at);
746 print_font_design_size(cur_font_dsize);
747 right();
748 }
749 }
750
751 void
752 input_ovf_chars(void)
753 {
754 int pl,cc,wd;
755
756 while ((*ovf_ptr & 0xff) <= VF_LONG_CHAR) {
757 if ((*ovf_ptr & 0xff) == VF_LONG_CHAR) {
758 ovf_ptr++;
759 in_ovf_4(&pl);
760 in_ovf_4(&cc);
761 in_ovf_4(&wd);
762 } else {
763 in_ovf(&pl);
764 in_ovf(&cc);
765 in_ovf_3(&wd);
766 }
767 ensure_existence(cc);
768 current_secondary_character->ovf_packet_length = pl;
769 current_secondary_character->ovf_packet = ovf_ptr;
770 ovf_ptr += pl;
771 }
772 while (ovf_ptr < (ovf+length_ovf)) {
773 if ((*ovf_ptr & 0xff) != DVI_POST)
774 fatal_error_0("Not a VF or OVF file; final bytes should be 248");
775 ovf_ptr++;
776 }
777 }