home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_progs / prog_c / suplib.lzh / SUPLIB / SRC / GETFONT.C < prev    next >
C/C++ Source or Header  |  1991-08-16  |  741b  |  46 lines

  1.  
  2.  
  3. /*
  4.  *  This function properly searches resident and disk fonts for the
  5.  *  font.
  6.  *
  7.  */
  8.  
  9. #include <local/typedefs.h>
  10.  
  11. #include <local/xmisc.h>
  12.  
  13. extern struct Library *DiskfontBase;
  14.  
  15. FONT *
  16. GetFont(name, size)
  17. char *name;
  18. short size;
  19. {
  20.     register FONT *font1;
  21.     TA Ta;
  22.     short libwasopen = (DiskfontBase != NULL);
  23.  
  24.     Ta.ta_Name    = (ubyte *)name;
  25.     Ta.ta_YSize = size;
  26.     Ta.ta_Style = 0;
  27.     Ta.ta_Flags = 0;
  28.  
  29.     font1 = OpenFont(&Ta);
  30.     if (font1 == NULL || font1->tf_YSize != Ta.ta_YSize) {
  31.     register FONT *font2;
  32.  
  33.     if (openlibs(DISKFONT_LIB)) {
  34.         if (font2 = OpenDiskFont(&Ta)) {
  35.         if (font1)
  36.             CloseFont(font1);
  37.         font1 = font2;
  38.         }
  39.         if (!libwasopen)
  40.         closelibs(DISKFONT_LIB);
  41.     }
  42.     }
  43.     return(font1);
  44. }
  45.  
  46.