home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PROGRAMS / UTILS / LASER / XFNTFILT.ZIP / MAKESHAD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-01-13  |  1.6 KB  |  83 lines

  1. /**********************************
  2.  * MAKESHAD.C
  3.  *
  4.  * Make Shadow Fonts
  5.  *
  6.  * James Bumgardner 1987
  7.  **********************************/
  8.  
  9. #include <stdio.h>
  10. #include <ctype.h>
  11.  
  12. void process_font_header(int smear);
  13. void process_char(int h, int w, int smear);
  14.  
  15. #include "ffilters.h"
  16.  
  17. #define DEFAULT_SMEAR    10
  18.  
  19. void process_font_header(int smear)
  20. {
  21.     if (smear == 0)
  22.         smear = DEFAULT_SMEAR;
  23.     font_header.width += smear;
  24.     font_header.height += smear;
  25. }
  26.  
  27. void process_char(int h, int w, int smear)    /* Process pmap[0] --> pmap[1] */
  28. {
  29.     register int y, x;
  30.     register char i, sflg;
  31.  
  32.     if (smear == 0)
  33.         smear = DEFAULT_SMEAR;
  34.  
  35.     char_header.width += smear;
  36.     char_header.height += smear;
  37.     char_header.delta_x += smear;
  38.  
  39.     for (y = 0; y < h+smear; ++y)    /* Blank Output */
  40.         for (x = 0; x < w + smear+8; ++x)
  41.             pmap[1][y][x] = 0;
  42.  
  43.     for (i = (char) (smear-1); i >= '\0'; --i)
  44.         for (y = 0; y < h; ++y)
  45.             for (x = 0; x < w; ++x)
  46.                 if (pmap[0][y][x])
  47.                     pmap[1][y+(int) i][x+(int) i] = (i == '\0') ? '\0' : '\1';
  48.  
  49.     /*
  50.      * fill in North West Outlines - remove the
  51.      * following portion of code
  52.      * to make another interesting font
  53.          */
  54.  
  55.     for (y = 0; y < h; ++y) {
  56.         sflg = 0;
  57.         for (x = 0; x < w; ++x) {
  58.             if (pmap[0][y][x]) {
  59.                 if (sflg == 0) {
  60.                     pmap[1][y][x] = 1;
  61.                     sflg = 1;
  62.                 }
  63.             }
  64.             else
  65.                 sflg = 0;
  66.         }
  67.     }
  68.  
  69.     for (x = 0; x < w; ++x) {
  70.         sflg = 0;
  71.         for (y = 0; y < h; ++y) {
  72.             if (pmap[0][y][x]) {
  73.                 if (sflg == 0) {
  74.                     pmap[1][y][x] = 1;
  75.                     sflg = 1;
  76.                 }
  77.             }
  78.             else
  79.                 sflg = 0;
  80.         }
  81.     }
  82. }
  83.