home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / Template / c / UseOutFont < prev   
Encoding:
Text File  |  1993-06-29  |  1.7 KB  |  53 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Template.UseOutFont.c
  12.     Author:  Copyright © 1993 Jason Williams
  13.     Version: 1.00 (29 Jun 1993)
  14.     Purpose: Support for use of outline fonts in templates
  15. */
  16.  
  17.  
  18. #include "TempDefs.h"
  19.  
  20. #include "DeskLib:Font.h"
  21.  
  22.  
  23. static void Template_ExitHandler(void)
  24. /*  Called on exit to clean up the fonts we're using */
  25. {
  26.   if ((int) template_fontarray > 0)
  27.     Font_LoseAllFonts(template_fontarray);
  28.  
  29.  
  30. extern void Template_UseOutlineFonts(void)
  31. /*  Allocates store for the font usage array - must be called before calls
  32.  *  to Template_LoadFile or your outline fonts won't be used.
  33.  *  Note that if it fails, it does so quietly - your windows will come up
  34.  *  without outline fonts.
  35.  */
  36. {
  37.   if ((int) template_fontarray > 0) return;
  38.  
  39.   template_fontarray = malloc(sizeof(font_array));
  40.   if (template_fontarray == NULL)
  41.     template_fontarray = (font_array *) -1;     /* Failed! Ensure we are safe*/
  42.   else
  43.   {
  44.     int i;
  45.  
  46.     for (i = 0; i < 256; i++)                   /* Initialise counts to zero */
  47.       template_fontarray->fonts[i] = 0;
  48.  
  49.     atexit(Template_ExitHandler);               /* Set up exit handler       */
  50.   }
  51. }
  52.