home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / haswinlib / c / fonts < prev    next >
Encoding:
Text File  |  1991-02-04  |  1.8 KB  |  61 lines

  1. /* > $.CLIB.C.fonts
  2.  *
  3.  *      HASWIN Graphics Library
  4.  *     =========================
  5.  *
  6.  *      Copyright (C) H.A.Shaw 1990.
  7.  *              Howard A. Shaw.
  8.  *              The Unit for Space Sciences,
  9.  *              Room 165,
  10.  *              Physics Building,
  11.  *              University of Kent at Canterbury.
  12.  *              Canterbury.
  13.  *              Kent.  CT2 7NJ
  14.  *      You may use and distribute this code freely, however please leave
  15.  *      it alone.  If you find bugs (and there will be many) please contact
  16.  *      me and the master source can be modified.  If you keep me informed
  17.  *      of who you give copies of this to then I can get release upgrades
  18.  *      to them.
  19.  *
  20.  *     font system control routines.
  21.  */
  22. #include "includes.h"
  23.  
  24. void haswin_finishedfonts() {
  25.  
  26.         int     fnum, fcnt;
  27.         _kernel_swi_regs  regs;
  28.  
  29.         /* use Font_LoseFont to remove fonts */
  30.         for (fnum=0; fnum<256; fnum++) {
  31.                 for(fcnt=0; fcnt<(int)haswin_fontarray[fnum]; fcnt++) {
  32.                         regs.r[0] = fnum;
  33.                         if (!haswin_swi(FONT_Lose_font, ®s))
  34.                                 return;
  35.                 }
  36.         }
  37. }
  38.  
  39. /*
  40.  *      search for a font, returning its number if found and HASWIN_FALSE
  41.  *      if not found.
  42.  */
  43. int haswin_findfont(char *name, int xsize, int ysize, int xscale, int yscale) {
  44.         _kernel_swi_regs        regs;
  45.  
  46.         if (!name)
  47.                 return(HASWIN_FALSE);
  48.         regs.r[1] = (int)name;
  49.         regs.r[2] = 16*xsize;
  50.         regs.r[3] = 16*ysize;
  51.         regs.r[4] = xscale;
  52.         regs.r[5] = yscale;
  53.         if (!haswin_swi(FONT_Find_font, ®s))
  54.                 return(HASWIN_FALSE);
  55.         if ((regs.r[0] > 255) || (regs.r[0] < 0))
  56.                 return(HASWIN_FALSE);
  57.         haswin_fontarray[regs.r[0] & 0xFF]++;
  58.         return(regs.r[0] & 0xFF);
  59. }
  60.  
  61.