summaryrefslogtreecommitdiff
path: root/dviware/dvi2pcl/permfonts.c
blob: b8da639c4cdb19a7f9cb07837a857805fd352acb (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

/*
 * Determines how many fonts are permanently downloaded and which of them
 * correspond to the fonts, used in the .dvi file. Those are marked in their
 * font->down by the identifier fdown. All font information for a permanent
 * downloaded font is taken from its .tfm file by calling `loadtfmfile'.
 */

#include <stdio.h>
#include "globals.h"

int permfonts(resfile)
FILE	*resfile;
{
	char	buffer[TERMLINELENGTH];
	char	orient[2];
	char	resname[NAMELENGTH];
	char	*fontname;
	int	act_fonts_down = 0;
	int	f;
	int	fdown;
	int	fsize;

  while(fscanf(resfile,"%s %d %d %s", buffer, &fsize, &fdown, orient) != EOF)
    if(buffer[0] == 'M')
      printer.mem = fsize;
    else
    { 
      while(getc(resfile) >= ' ');
      if((orient[0] == 'L' && landscape)
        || (orient[0] == 'P' && !landscape)) { 
        for (f=0; f<MAXFONTS; f++)
          if(font = fontptr[f]) { 
            if(font->dir_size == fsize) { 
              fontname = names + font->name;
              if(!*fontname) { 
                fontname++;
                if(!strcmp(fontname,buffer)) { 
		  font->down = fdown;
		  loadtfmfile();
                }
              }
            }
          }
        act_fonts_down++;
      }
    }
  (void)fclose(resfile);
  return(act_fonts_down);
}