home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / printer / dvi2pcl.lha / permfonts.c < prev    next >
C/C++ Source or Header  |  1992-11-25  |  1KB  |  51 lines

  1.  
  2. /*
  3.  * Determines how many fonts are permanently downloaded and which of them
  4.  * correspond to the fonts, used in the .dvi file. Those are marked in their
  5.  * font->down by the identifier fdown. All font information for a permanent
  6.  * downloaded font is taken from its .tfm file by calling `loadtfmfile'.
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include "globals.h"
  11.  
  12. int permfonts(resfile)
  13. FILE    *resfile;
  14. {
  15.     char    buffer[TERMLINELENGTH];
  16.     char    orient[2];
  17.     char    resname[NAMELENGTH];
  18.     char    *fontname;
  19.     int    act_fonts_down = 0;
  20.     int    f;
  21.     int    fdown;
  22.     int    fsize;
  23.  
  24.   while(fscanf(resfile,"%s %d %d %s", buffer, &fsize, &fdown, orient) != EOF)
  25.     if(buffer[0] == 'M')
  26.       printer.mem = fsize;
  27.     else
  28.     { 
  29.       while(getc(resfile) >= ' ');
  30.       if((orient[0] == 'L' && landscape)
  31.         || (orient[0] == 'P' && !landscape)) { 
  32.         for (f=0; f<MAXFONTS; f++)
  33.           if(font = fontptr[f]) { 
  34.             if(font->dir_size == fsize) { 
  35.               fontname = names + font->name;
  36.               if(!*fontname) { 
  37.                 fontname++;
  38.                 if(!strcmp(fontname,buffer)) { 
  39.           font->down = fdown;
  40.           loadtfmfile();
  41.                 }
  42.               }
  43.             }
  44.           }
  45.         act_fonts_down++;
  46.       }
  47.     }
  48.   (void)fclose(resfile);
  49.   return(act_fonts_down);
  50. }
  51.