home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 171.lha / SupLib / getfont.c < prev    next >
C/C++ Source or Header  |  1988-04-28  |  728b  |  44 lines

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