summaryrefslogtreecommitdiff
path: root/dviware/dvi2qms/qmsfonts.c
blob: a652f85b9565bdfa9a5c329cb3f1fe32469fe594 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
/* qmsfonts.c: font module for dvi printing on qms printers
 * Copyright 1985 Massachusetts Institute of Technology
 * Some portions were written by Scott Simpson, TRW
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/dir.h>
#include "util.h"
#include "fonts.h"
#include "findfile.h"

#define MAXDVIFONTS  256	/* Maximum number of DVI fonts allowed */
#define MAXQMSFONTS  256	/* Maximum number of QMS fonts allowed */
#define QMSMAXBLOCKS 386	/* Stated on qms status page */
#define MAXCHARS     128	/* Max chars per QMS font */
#define MAXFNTDIR     16	/* Max number of dirs to look for fonts */
#define MAXFNTNAMLEN  32	/* Maximum number of chars in a font name */
#define USEROTPXL      1	/* Write and read rotated pxl files */

#define DELETEFONT "^DF%05.5d%c^G"
#define DEFINEFONT "^(^DF%05.5d%c%c%4.4s%03.3dT"
#define ADDTOFONT  "^(^DFI%05.5d%c%c%4.4s%03.3dT"
#define DEFINECHAR ",%c%c%03.3d%03.3d%03.3d%c%03.3d%c%03.3d"
#define ENDDEF     "^G^)"
#define SELECTFONT "^IS%05.5d"

unsigned char *malloc();
char *strcat();
char *strcpy();
char *strncpy();
char *strncmp();
char *strcmp();

long numerator,denominator,half_denominator,jobmag;
char job_orientation,printer_orientation;

int      freeblocks = QMSMAXBLOCKS;   /* free space on printer */
char     *hex = "0123456789ABCDEF";   
FILE     *qms;                        /* output device */
char *filter_name;                    /* the name of the calling prog */
char *fntdirvec[MAXFNTDIR];
int fntdirveclen;

#define QC_LOADED    0x0001	/* Char has been loaded in the printer */
#define QC_NOGLYPH   0x0002	/* Glyph is still in pxl file */
#define QC_ROTATED   0x0004	/* Glyph has been rotated */
#define QC_NEEDED    0x0008	/* This char is needed on this page */

struct qmschar {
  short qc_info,qc_qmswidth;
  short qc_height,qc_width;
  short qc_xoffset,qc_yoffset;
  long  qc_texwidth,qc_pxlwidth;
  union {long l; unsigned char *p} qc_glyph;
};

#define QF_LOADED    0x0001	/* Font has been loaded into printer */
#define QF_RELOAD    0x0002	/* We have to load more needed chars */
#define QF_FILE      0x0004	/* Font hasn't been loaded from the file */

struct qmsfont {
  short          qf_info;
  short          qf_qmsnumber;
  short          qf_maxheight;
  long           qf_mag;
  long           qf_words_used;
  long           qf_words_needed;
  long           qf_timestamp;
  char           qf_qmsname[4];
  long           qf_pxl_checksum;
  long           qf_pxl_mag_val;
  long           qf_pxl_design_size;
  long           qf_s;
  char           qf_name[MAXFNTNAMLEN];
  char           qf_filename[MAXNAMLEN];
  struct qmschar qf_char[MAXCHARS]; 
} *qmsfonts[MAXQMSFONTS];

int nqmsfonts;
struct qmsfont *curfnt; /* ptr to current and last font */
long timestamp;			/* Timestamp for stamping qms fonts */

/* The dvifont struct provides a (possible) many-to-one mapping
 * because several DVI fonts can map to the same QMS font during font
 * substitution.
 */
struct dvifont {
  unsigned long   df_num;	/* DVI font number */
  struct qmsfont  *df_qmsfont;	/* Font which contains */
} dvifonts[MAXDVIFONTS];
int ndvifonts;

long max(a,b)
     long a,b;
{
  return((a>b)? a:b);
}

long min(a,b)
     long a,b;
{
  return((a<b)? a:b);
}

/* called at the beginning of the driver program */
f_init(printer,pgmnam,dirvec,dirveclen,num,den,mag,options)
FILE *printer;
char *pgmnam,*dirvec[];
int dirveclen;
long num,den,mag;
unsigned long options;
{
  int i;
  
  numerator = num;
  denominator = den;
  half_denominator = denominator / 2;
  jobmag = mag;
  fntdirveclen = min(MAXFNTDIR,dirveclen);
  for (i = 0; i < fntdirveclen; i++) fntdirvec[i] = dirvec[i];
  ndvifonts = 0;
  nqmsfonts = 0;
  timestamp = 0;
  qms = printer;
  filter_name = pgmnam;
  if (options & F_INIT_LANDSCAPE) job_orientation = 'L';
  else job_orientation = 'P';
  if (options & F_INIT_QMS800) printer_orientation = 'P';
  else printer_orientation = 'L';
}

/* Called at the end of the driver program. */
f_term()
{
}

struct qmsfont *
find_qmsfont(area,name,texmag,s)
     char *area,*name;
     long texmag,s;
{
  char fname[MAXNAMLEN],nname[128];
  int i,nmag;
  int mag = (texmag * 3 + 1) / 2;
  struct qmsfont *fnt;

  /* try to find a font file */
  if (!findfile(fntdirvec,fntdirveclen,area,name,mag,fname,nname,&nmag))
    croak("no font %s.%d",name,texmag);
  
  /* make a new qms font */
  if (nqmsfonts >= MAXQMSFONTS) croak("too many qms fonts");
  if (!(qmsfonts[nqmsfonts++] = fnt =
	(struct qmsfont *) malloc(sizeof(struct qmsfont)))) 
    croak("malloc %d",sizeof(struct qmsfont));
  fnt->qf_mag = nmag;
  fnt->qf_timestamp = 0;
  fnt->qf_words_needed = 400;
  fnt->qf_words_used = 0;
  fnt->qf_qmsnumber = nqmsfonts + 1000;
  sprintf(fnt->qf_qmsname,"%04.4d",fnt->qf_qmsnumber);
  fnt->qf_maxheight = 0;
  fnt->qf_s = s;
  strcpy(fnt->qf_name,nname);
  strcpy(fnt->qf_filename,fname);
  fnt->qf_info = QF_FILE;
  return(fnt);
}

getfontfromfile(fnt)
     struct qmsfont *fnt;
{
  char fname[MAXNAMLEN];
  FILE *f;
  int i;

  sprintf(fname,"%sr",fnt->qf_filename);
  if (USEROTPXL && job_orientation != printer_orientation) {
    if (!access(fname,4)) readpxlfile(fnt,fname,1);
    else {
      readpxlfile(fnt,fnt->qf_filename,0);
      if (f = fopen(fname,"w")) {
	fclose(f);
	for (i = 0; i < MAXCHARS; i++) rotate(&(fnt->qf_char[i]),fnt);
	writepxlfile(fnt,fname);
      }
    }
  } else readpxlfile(fnt,fnt->qf_filename,0);
  fnt->qf_info &= ~QF_FILE;
}

writepxlfile(fnt,fname)
     struct qmsfont *fnt;
     char *fname;
{
  FILE *f;
  long glyphaddrs[MAXCHARS],pxl_dir_ptr;

  if (!(f = fopen(fname,"w"))) croak("can't open %s to write",fname);
  put4(1001,f);
  writeglyphs(fnt,f,glyphaddrs);
  pxl_dir_ptr = ftell(f) / 4;
  writepxldir(fnt,f,glyphaddrs);
  put4(fnt->qf_pxl_checksum,f);
  put4(fnt->qf_pxl_mag_val,f);
  put4(fnt->qf_pxl_design_size,f);
  put4(pxl_dir_ptr,f);
  put4(1001,f);
  fclose(f);
}

writepxldir(fnt,f,glyphaddrs)
     struct qmsfont *fnt;
     FILE *f;
     long glyphaddrs[];
{
  int i;
  struct qmschar *c;

  for (i = 0; i < MAXCHARS; i++) {
    c = &(fnt->qf_char[i]);
    put2(c->qc_width,f);
    put2(c->qc_height,f);
    put2(c->qc_xoffset,f);
    put2(c->qc_yoffset,f);
    put4(glyphaddrs[i],f);
    put4(c->qc_pxlwidth,f);
  }
}

writeglyphs(fnt,f,glyphaddrs)
     struct qmsfont *fnt;
     FILE *f;
     long glyphaddrs[];
{
  register int j;
  int i,fbw,bw,row;
  struct qmschar *c;
  register unsigned char *p;

  for (i = 0; i < MAXCHARS; i++) {
    c = &(fnt->qf_char[i]);
    if (c->qc_glyph.p) {
      glyphaddrs[i] = ftell(f) / 4;
      /* Write out this glyph to the PXL file */
      p = c->qc_glyph.p;
      bw = (c->qc_width + 7) / 8;
      fbw = ((c->qc_width + 31) / 32) * 4;
      for (row = 0; row < c->qc_height; row++) {
	for (j = 0; j < bw; j++) putc(*p++,f);
	for (j = bw; j < fbw; j++) putc(0,f);
      }
    } else glyphaddrs[i] = 0;
  }
}

int char_words_needed(c)
     struct qmschar *c;
{
  if (c->qc_info & QC_ROTATED)
    return(((c->qc_width + 15) / 16) * c->qc_height);
  else
    return(((c->qc_height + 15) / 16) * c->qc_width);
}

int font_blocks_used(fnt)
     struct qmsfont *fnt;
{
  return((fnt->qf_words_used + 511) / 512);
}

int font_blocks_needed(fnt)
     struct qmsfont *fnt;
{
  return((fnt->qf_words_needed + fnt->qf_words_used + 511) / 512
	 - font_blocks_used(fnt));
}

/* Define a font.
 * Can be called more than once for the same font.
 */
f_define_font(num,options,area,name,texmag,s,tfmchecksum)
char *area,*name;
unsigned long num,options,texmag,s,tfmchecksum;
{
  int i;

  /* check to see if font is already defined */
  for(i = 0; i < ndvifonts ; i++) if (dvifonts[i].df_num == num) return;

  /* Does this make too many fonts defined? */
  if (ndvifonts >= MAXDVIFONTS) croak("too many dvi fonts");
  dvifonts[ndvifonts].df_num = num;
  dvifonts[ndvifonts++].df_qmsfont = find_qmsfont(area,name,texmag,s);
}

struct qmsfont *
find_dvi_font(fontnum)
     unsigned long fontnum;
{
  register int i;

  /* scan through the dvi font list. */
  for(i = 0; i < ndvifonts ; i++)
    if (dvifonts[i].df_num == fontnum) {
      dvifonts[i].df_qmsfont->qf_timestamp = timestamp++;
      return(dvifonts[i].df_qmsfont);
    }
  croak("no dvi font %d defined",fontnum);
}

/* Set a font as the current font.
 */
f_use_font(fontnum,font_space)
unsigned long fontnum;
long *font_space;
{
  curfnt = find_dvi_font(fontnum);
  if (curfnt->qf_info & QF_FILE) getfontfromfile(curfnt);
  /* Make sure that it's loaded in the printer */
  if (!(curfnt->qf_info & QF_LOADED)
      || (curfnt->qf_info & QF_RELOAD))
    download_font(curfnt);
  /* Start using it */
  fprintf(qms,SELECTFONT,curfnt->qf_qmsnumber);
  *font_space = curfnt->qf_s / 6;
}

/* Hints as to what fonts are to be used.
 * This is called once per page to give fonts module hints as what fonts
 * and characters in those fonts are going to be used on this page.
 */
f_newpage(fontvec,charvec,veclen)
     unsigned long fontvec[];
     unsigned long charvec[][4];
     int veclen;
{
  struct qmschar *c;
  register int i,j;
  struct qmsfont *f;

  for (i = 0; i < veclen; i++) {
    f = find_dvi_font(fontvec[i]);
    if (f->qf_info & QF_FILE) getfontfromfile(f);
    if (!(f->qf_info & QF_LOADED)) {
      f->qf_words_used = 0;
      f->qf_words_needed = 400;
    }
    for (j = 0; j < MAXCHARS; j++) 
      if (charvec[i][j/32] & (1 << (j % 32))) {
	c = &(f->qf_char[j]);
	c->qc_info |= QC_NEEDED;
	if (!(c->qc_info & QC_LOADED)) {
	  f->qf_info |= QF_RELOAD;
	  f->qf_words_needed += char_words_needed(c);
	}
      } else f->qf_char[j].qc_info &= ~QC_NEEDED;
  }
}

clear(p,n)
     char *p;
     int n;
{
  while (n-- > 0) *p++ = 0;
}

rotate(c,fnt)
     struct qmschar *c;
     struct qmsfont *fnt;
{
  unsigned char *oldglyph = c->qc_glyph.p;
  unsigned int width = (unsigned int)c->qc_width;
  unsigned int  height = (unsigned int)c->qc_height;
  int newbyteswide = (c->qc_height + 7) / 8;
  int oldbyteswide = (c->qc_width + 7) / 8;
  unsigned char *newglyph,*putbyte;
  int column;
  int row = -1;			/* Start row at 0 when incremented */
  int mask;
  int i, j;
  int times;
  int extractbyte;

  if (!(c->qc_info & QC_NOGLYPH)) {
    if (!(newglyph = malloc(newbyteswide * width)))
      croak("malloc %d",newbyteswide * width);
    clear(newglyph, newbyteswide * width);

    for (i = 0; i < oldbyteswide * height; i++) {
      extractbyte = *(oldglyph + i);
      if (i % oldbyteswide == 0) row++;
      times = (i + 1) % oldbyteswide ? 8 : (width + 7) % 8 + 1;
      for (j = 0, mask = 0x80; j < times; j++, mask >>= 1) {
	column = (((i % oldbyteswide) == 0) && (j == 0)) ? 0 : (column + 1);
	if (mask & extractbyte) {
	  putbyte = newglyph + column * newbyteswide +
	    (int)((height - (row + 1)) / 8);
	  *putbyte |= 1 << 7 - ((height + 7) - row) % 8;
	}
      }
    }
    free(oldglyph);
    c->qc_glyph.p = newglyph;
  }
  c->qc_info |= QC_ROTATED;
  i = c->qc_width;
  c->qc_width = c->qc_height;
  c->qc_height = i;
  i = c->qc_xoffset;
  c->qc_xoffset = c->qc_width - c->qc_yoffset - fnt->qf_maxheight;
  c->qc_yoffset = i;
}

/* Load a font into the qms.
 */
download_font(fnt)
     struct qmsfont *fnt;
{
  register int i;

  if (font_blocks_needed(fnt) > freeblocks)
    qmsfree(font_blocks_needed(fnt));
  freeblocks -= font_blocks_needed(fnt);
  fnt->qf_words_used += fnt->qf_words_needed;
  fnt->qf_words_needed = 0;
  if (fnt->qf_info & QF_LOADED) {
    fprintf(qms,
	    ADDTOFONT,
	    fnt->qf_qmsnumber,job_orientation,
	    1,fnt->qf_qmsname,fnt->qf_maxheight);
  } else {
    fprintf(qms,
	    DEFINEFONT,
	    fnt->qf_qmsnumber,job_orientation,
	    1,fnt->qf_qmsname,fnt->qf_maxheight);
  }
  for (i = 0; i < MAXCHARS; i++)
    if ((fnt->qf_char[i].qc_info & QC_NEEDED)
	&& !(fnt->qf_char[i].qc_info & QC_LOADED))
	  load_char(i,fnt);
  fprintf(qms,ENDDEF);
  fnt->qf_info |= QF_LOADED;
  fnt->qf_info &= ~QF_RELOAD;
}

load_char(ch,fnt)
     unsigned long ch;
     struct qmsfont *fnt;
{
  register unsigned char *bp;
  register int bytes;
  struct qmschar *c = &(fnt->qf_char[ch]);
  int row,bw,bo;

  if (job_orientation != printer_orientation
      && !(c->qc_info & QC_ROTATED)) rotate(c,fnt);
  bp = c->qc_glyph.p;
  fprintf(qms,DEFINECHAR,hex[(ch >> 4) & 017],hex[ch & 017],
	  c->qc_qmswidth,c->qc_height,c->qc_width,
	  (c->qc_yoffset < 0) ? '+' : '-',abs(c->qc_yoffset),
	  (c->qc_xoffset < 0) ? '+' : '-',abs(c->qc_xoffset));
  bw = (c->qc_width + 7) / 8;
  bo = ((c->qc_width + 15) / 16) * 2;
  for (row = 0; row < c->qc_height; row++) {
    for (bytes = 0; bytes < bw; bytes++) putc(*bp++,qms);
    if (bw != bo) putc(0,qms);
  }
  c->qc_info |= QC_LOADED;
}

int readpxlfile(fnt,fname,rotated)
     struct qmsfont *fnt;
     char *fname;
     int rotated;
{
  long pxl_id,pxl_dir_ptr;
  FILE *f;

  if (!(f = fopen(fname,"r"))) croak("no pxl file %s",fname);
  if ((pxl_id = sget4(f)) != 1001)
    croak("%d bad initial pxl ID; %s doesn't look like a pxl file",
	  pxl_id, fnt->qf_filename);

  /* Read the last 5 longs from the pxl file */
  (void) fseek(f, (long)(-5*4), 2);
  fnt->qf_pxl_checksum = sget4(f);
  fnt->qf_pxl_mag_val = sget4(f);
  fnt->qf_pxl_design_size = sget4(f);
  pxl_dir_ptr = sget4(f);
  if ((pxl_id = sget4(f)) != 1001)
    croak("%d bad final pxl ID; %s doesn't look like a pxl file",
	  pxl_id, fnt->qf_filename);
  if (pxl_dir_ptr != ftell(f) / 4 - 517) 
    croak("%s pxl dir ptr is %x, should be %x",
	  fnt->qf_filename, pxl_dir_ptr, ftell(f) / 4 - 517);
  debug("pxl: checksum %d mag %d designsize %d dir %x\n",
	fnt->qf_pxl_checksum,fnt->qf_pxl_mag_val,
	fnt->qf_pxl_design_size,pxl_dir_ptr);

  /* Read the directory */
  (void) fseek(f, pxl_dir_ptr * 4, 0);
  getpxldir(fnt,f,rotated);
  debug("     %s max_height=%d\n",fnt->qf_filename,fnt->qf_maxheight);

  /* Read in all the glyphs */
  getglyphs(fnt,f);

  (void) fclose(f);
}

getpxldir(fnt,f,rotated)
     struct qmsfont *fnt;
     FILE *f;
     int rotated;
{
  int i;
  struct qmschar *c;
  double ds = ((double) fnt->qf_s) / ((double) (1 << 20));

  fnt->qf_maxheight = 0;
  for (i = 0; i < MAXCHARS; i++) {
    c = &(fnt->qf_char[i]);
    c->qc_width = sget2(f);
    c->qc_height = sget2(f);
    c->qc_xoffset = sget2(f);
    c->qc_yoffset = sget2(f);
    c->qc_glyph.l = get4(f);
    c->qc_pxlwidth = sget4(f);
    c->qc_texwidth = (long) (((double) c->qc_pxlwidth) * ds);
    c->qc_qmswidth = 
      (c->qc_texwidth * numerator + half_denominator) / denominator;
    if (rotated) {
      c->qc_info = QC_NOGLYPH | QC_ROTATED;
      fnt->qf_maxheight = max(fnt->qf_maxheight,c->qc_width);
    } else {
      c->qc_info = QC_NOGLYPH;
      fnt->qf_maxheight = max(fnt->qf_maxheight,c->qc_height);
    }
  }
}

getglyphs(fnt,f)
     struct qmsfont *fnt;
     FILE *f;
{
  register int j,row;
  register unsigned char *p;
  int i,fbw,bw;
  struct qmschar *c;

  for (i = 0; i < MAXCHARS; i++) {
    c = &(fnt->qf_char[i]);
    if (c->qc_glyph.l) {
      (void) fseek(f, c->qc_glyph.l * 4, 0);
      fbw = ((c->qc_width + 31) / 32) * 4;
      bw = (c->qc_width + 7) / 8;
      if (!(p = malloc(bw * c->qc_height)))
	croak("malloc %d",bw * c->qc_height);
      c->qc_glyph.p = p;
      for (row = 0; row < c->qc_height; row++) {
	for (j = 0; j < bw; j++) *p++ = getc(f);
	for (j = bw; j < fbw; j++) (void) getc(f);
      }
      c->qc_info &= ~QC_NOGLYPH;
    }
  }
}

/* Make sure that the font info for this character is loaded.
 * Characters are incrementally loaded into the printer.
 * This procedure is called for every character so it must be fast.
 */
f_use_char(ch,texwidth,devwidth)
unsigned long ch;
long *texwidth,*devwidth;
{
  register struct qmschar *c = &(curfnt->qf_char[ch]);

  *texwidth = c->qc_texwidth;
  *devwidth = c->qc_qmswidth;
}


/* free blocks by deleting font(s) using LRU strategy */
int qmsfree(blocks)
     int blocks;
{
  int i,oldtime;
  struct qmsfont *oldfont;  

  while (blocks > freeblocks) {
    oldfont = NULL;
    oldtime = timestamp;
    for (i = 0; i < nqmsfonts; i++)
      if ((qmsfonts[i]->qf_info & QF_LOADED)
	  && (qmsfonts[i]->qf_timestamp < oldtime)) {
	oldfont = qmsfonts[i];
	oldtime = oldfont->qf_timestamp;
      }
    if (!oldfont) croak("qmsfree bug");
    fprintf(qms,DELETEFONT,oldfont->qf_qmsnumber,job_orientation);
    freeblocks += font_blocks_used(oldfont);
    oldfont->qf_info &= ~QF_LOADED;
    oldfont->qf_words_needed = 400;
    oldfont->qf_words_used = 0;
    for (i = 0; i < MAXCHARS; i++) {
      oldfont->qf_char[i].qc_info &= ~QC_LOADED;
      if (oldfont->qf_char[i].qc_info & QC_NEEDED)
	oldfont->qf_words_needed += char_words_needed(&(oldfont->qf_char[i]));
    }
  }
}